NYMEZIDE
Новичок
сохранить сайт(страничку) на диск
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://weather.yandex.ru/?city=35121");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
$file = curl_exec($ch);
curl_close($ch);
$data = fopen("../yandexpogoda.xml","w");
fputs($data,$file);
fclose($data);
не работает этот код. который должен сохранить страничку на диск.
как заставить работать CURL ?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://weather.yandex.ru/?city=35121");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
$file = curl_exec($ch);
curl_close($ch);
$data = fopen("../yandexpogoda.xml","w");
fputs($data,$file);
fclose($data);
не работает этот код. который должен сохранить страничку на диск.
как заставить работать CURL ?