解决方案 »
- 如何购买数据库?
- 现在有个情况是,要专门记录一个总数。例如增加一个会员,就要相应的记录总数。
- php能否检测是否include了某个文件
- 急!!string经过zip之后存在SQL Server的image字段,PHP怎么取出字段显示呢
- php数组问题,请看下面贴出的代码
- 请问用PHP是否可以实现生产者消费者的问题?
- fpdf創建問題
- 大家好,请教一下php中有没有类似perl语言的index函数!!非常感谢!!!!
- 在什么样的print里面可以使用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