PHP - CURL. Grabar fichero

 
Vista:

CURL. Grabar fichero

Publicado por Javier (1 intervención) el 31/05/2010 14:22:18
Hola,

Intento leer el contenido visible de una web y volcarlo a un fichero, pero sólo lo graba en pantalla, mientras que el archivo ni se crea si no existe ni se modifica en caso de exisitir. El código es :

Código:

<html>
<head>
<title>Titulo
</title>
</head>
<body>
<?php
$ch = curl_init("http://www.google.es");
$fp = fopen("fichero.txt", "w+");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

fwrite($fp,'hkjhlkjhlk');

curl_exec($ch);

fflush($fp);

curl_close($ch);
fclose($fp);
?>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder