I am trying to get the contents of a webpage and echo it out over a proxy but the code below doesn't return anything (I have tried several URLs, same result). Thoughts on what could cause this? I also tried swapping proxy addresses... same no result:
function url_get_contents2 ($url) {
$proxy = '###.###.###.###:8080';
//$proxyauth = 'user:password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
return $curl_scraped_page;
}
echo url_get_contents2("https://www.whatismybrowser.com/");