$output_filename = "work.txt";
$host = "http://www.indeed.com/l-Cuyahoga-Falls,-Ohio-jobs.html";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
print_r($result); // prints the contents of the collected file before writing..
// the following lines write the contents to a file in the same directory (provided permissions etc)
$fp = fopen($output_filename, 'w');
fwrite($fp, $result);
fclose($fp);
它会在您上载脚本的目录中创建一个文件。然后它显示文件中的数据。但我很难尝试自动刷新间隔。我需要它自动更新。
如何整个页面下载?当我运行脚本时,很多图像有时不会一直显示出来。这是导致这种情况的网站吗?