使用curl库通过代理服务器访问网页
来源: 发布时间:星期一, 2009年1月12日 浏览:11次 评论:0
<? function curl_ ($url,$user_agent,$proxy){ $ch = curl_init; curl_opt ($ch, CURLOPT_PROXY, $proxy); curl_opt ($ch, CURLOPT_URL, $url); curl_opt ($ch, CURLOPT_USERAGENT, $user_agent); curl_opt ($ch, CURLOPT_COOKIEJAR, "c:cookie.txt"); curl_opt ($ch, CURLOPT_HEADER, 1); curl_opt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_opt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_opt ($ch, CURLOPT_TIMEOUT, 120); $result = curl_exec ($ch); curl_close($ch); $result; } $url_page = "http://www.366edu.net"; $user_agent = "Mozilla/4.0"; $proxy = "http://192.11.222.124:8000"; $ = curl_($url_page,$user_agent,$proxy); echo $; ?>
相关文章
读者评论
发表评论
|
|