【发布时间】:2010-04-01 11:48:40
【问题描述】:
我正在获取某个站点页面..
但它什么也不显示 和url地址变化。
我输入的示例
http://localhost/sushant/EXAMPLE_ROUGH/curl.php
在 curl 页面中我的编码是=
$fp = fopen("cookie.txt", "w");
fclose($fp);
$agent= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
// 2. set the options, including the url
curl_setopt($ch, CURLOPT_URL, "http://www.fnacspectacles.com/place-spectacle/manifestation/Grand-spectacle-LE-ROI-LION-ROI4.htm");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
// 3. execute and fetch the resulting HTML output
if(curl_exec($ch) === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
echo $output = curl_exec($ch);
// 4. free up the curl handle
curl_close($ch);
但它像这样访问网址..
http://localhost/aide.do?sht=_aide_cookies_
找不到对象。
如何解决这些问题对我有帮助
【问题讨论】:
-
我不明白“cookie.txt”的作用。显示错误:
error_reporting(E_ALL); -
您的问题到底是什么?什么不起作用?
-
不太清楚为什么 VolkerK 恢复了我的编辑...