curl - How to get url content through proxy ip and port in php? -
i want content of url through proxy. had taken proxy ip , port http://letushide.com/filter/http,all,all/list_of_free_http_proxy_servers
but using following code , return blank page.
$url = "http://google.co.in"; $agent = "mozilla/5.0 (x11; u; linux i686; en-us) applewebkit/532.4 (khtml, gecko) chrome/4.0.233.0 safari/532.4"; $referer = "http://www.google.com/"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_httpproxytunnel, 1); curl_setopt($ch, curlopt_proxy, '190.122.xxx.xxx:8080'); curl_setopt($ch, curlopt_referer, $referer); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_maxredirs, 2); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_connecttimeout, 10); curl_setopt($ch, curlopt_useragent, $agent); $data = curl_exec($ch); curl_close($ch); echo $data;
Comments
Post a Comment