[php]
$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.baidu.com/"); //构造来路
curl_setopt($ch,CURLOPT_URL, 'http://www.baidu.com');//需要抓取的页面路径
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)
[/php]
相关文章:
-
2021-05-18
-
2022-02-24
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-12-23
猜你喜欢
-
2022-12-23
-
2022-01-16
-
2021-12-06
-
2022-12-23
-
2021-07-10
-
2022-12-23
-
2022-12-23
相关资源
-
下载
2021-06-06
-
下载
2021-06-27
-
下载
2022-12-06