复制代码 代码如下:
$curlpost = 'a=1&b=2';//模拟post数据
$ch = curl_init();
curl_setopt($ch, curlopt_httpheader, array('x-forwarded-for:0.0.0.0', 'client-ip:0.0.0.0')); //构造ip
curl_setopt($ch, curlopt_referer, http://www.jb51.net/); //构造来路
curl_setopt($ch,curlopt_url, 'http://www.jb51.net');//需要抓取的页面路径
curl_setopt ($ch, curlopt_returntransfer, 1);
curl_setopt ($ch, curlopt_timeout, 30);
curl_setopt($ch, curlopt_postfields, $curlpost);//post值
$file_contents = curl_exec($ch);//抓取的内容放在变量中
curl_close($ch)
http://www.bkjia.com/phpjc/328109.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/328109.htmltecharticle最基本的操作如下 复制代码 代码如下: $curlpost = 'a=1//模拟post数据 $ch = curl_init(); curl_setopt($ch, curlopt_httpheader, array('x-forwarded-for:0.0.0.0', 'cli...
