Home > php教程 > php手册 > php代理采集代码

php代理采集代码

WBOY
Release: 2016-06-07 11:34:15
Original
1318 people have browsed it

php代理采集代码。
function curl_content ($url){<br>     $user_agent = "Mozilla/4.0";<br>     $proxy = "http://".get_proxy();<br>     $ch = curl_init();<br>     curl_setopt ($ch, CURLOPT_PROXY, $proxy);<br>     curl_setopt ($ch, CURLOPT_URL, $url);<br>     curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);<br>     curl_setopt ($ch, CURLOPT_COOKIEJAR, "e:\www\cookie.txt");<br>     curl_setopt ($ch, CURLOPT_HEADER, 1);<br>     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);<br>     curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);<br>     curl_setopt ($ch, CURLOPT_TIMEOUT, 120);<br>     $result = curl_exec ($ch);<br>     curl_close($ch);<br>     return $proxy.$result;<br> }<br>  <br> function get_proxy(){<br>     $proxys =  107.151.136.202:80<br> 1.34.223.206:80<br> 1.34.223.229:80<br> 189.8.82.82:80<br> str;<br>     $proxys = explode("\r\n", $proxys);<br>     $key = rand(1,count($proxys))-1;<br>     return $proxys[$key];<br> }代理ip自己网上采。。
用代理ip采集网站内容。。。

微信公众号导航 http://www.phpstd.com/wxjun
给予thinkhp3.2.3 全自动采集更新 全站连同前台共300行代码。

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template