php - Curl Request using proxy is not working -


i'm trying load remote website using curl request using proxies. have pasted below code in php file , tried run browser. loads remote url, however, in remote url's statistics it's showing local ip address!! why not showing proxy ip?

then tried run using cron tab. in time, remote website statistics not showing anything?

in short: want load remote website. remote website statistics tracker should show proxy ip user agent have specified in code.

<?php //debug error_reporting(e_all); ini_set('display_errors', 1); //debug end $url='http://www.example.com';   $agent = "mozilla/5.0 (x11; u; linux i686; en-us)              applewebkit/532.4 (khtml, gecko)              chrome/4.0.233.0 safari/532.4";             $proxy = "104.236.203.134:8080"; $proxy = explode(':', $proxy); $url = "http://google.com"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_proxy, $proxy[0]); curl_setopt($ch, curlopt_proxyport, $proxy[1]); curl_setopt($ch, curlopt_header, 1); $exec = curl_exec($ch); echo curl_error($ch); print_r(curl_getinfo($ch)); echo $exec; ?> 

let me know changes should make work specified?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -