解决方案 »
- 我下载了zend studio for eclipse 7.0.0,还需要下载PHP或者apache和IIS了吗
- 单点登录
- 关于open_basedir restriction in effect...File(/XXX/XXX) is not within the allowed path的问题
- 一个urlrewrite问题
- 求教smarty清空缓存判断的设计技巧
- 怎么计算访客在站点的停留时间啊,大侠们给个思路吧
- 求助~!!! 有没有人能帮我呢~??? 真的很急~!!!关于添加功能的问题~!!!
- 请大家进来帮我看看一段代码,最好“feyge(菲戈..人间有我残梦未醒)”能进来,谢谢!
- 我想知道,什么是PHP,可以告诉我吗
- 请问新闻分类显示怎么分?
- php与mysql 无法连接 mysql_connect() [function.mysql-connect]: Client does not suppor
- getallheaders函数问题
$url = "http://item.taobao.com/item.htm?id=14861616067";
echo curl_get($url);
得到的数据中有
<title>T浦力顿500g 成犬幼犬狗粮泰迪贵宾比熊金毛萨摩耶博美 批发散装-淘宝网</title>
<h3 class="tb-item-title">T浦力顿500g 成犬幼犬狗粮泰迪贵宾比熊金毛萨摩耶博美 批发散装</h3>
证明访问是没有问题的function curl_get($durl, $data=array()) {
$cookiejar = realpath('cookie.txt');
$t = parse_url($durl);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$durl);
curl_setopt($ch, CURLOPT_TIMEOUT,5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, "http://$t[host]/");
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if($data) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
$r = curl_exec($ch);
curl_close($ch);
return $r;
}
估计是 少了 CURLOPT_REFERER