“Descargar contenido HTML de URL PHP” Código de respuesta

Descargar contenido HTML de URL PHP

$c = curl_init('https://yourURLhere.com');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
//curl_setopt(... other options you want...)

$html = curl_exec($c);

if (curl_error($c))
    die(curl_error($c));

// Get the status code
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);

curl_close($c);
Amused Anteater

Descarga de archivos PHP de URL

Since PHP 5.1.0, file_put_contents() supports writing piece-by-piece by passing a stream-handle as the $data parameter:

file_put_contents("Tmpfile.zip", fopen("http://someurl/file.zip", 'r'));
From the manual:

If data [that is the second argument] is a stream resource, the remaining buffer of that stream will be copied to the specified file. This is similar with using stream_copy_to_stream().

(Thanks Hakre.)
Santino

Respuestas similares a “Descargar contenido HTML de URL PHP”

Preguntas similares a “Descargar contenido HTML de URL PHP”

Más respuestas relacionadas con “Descargar contenido HTML de URL PHP” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código