I am on my college network which uses a proxy server with authentication to browse the internet.
I am trying to fetch the data from a web-site using html_get_contents
, but running the script on the terminal gives me this error:
PHP Warning: file_get_contents(http://www.google.com/): failed to open stream:
Network is unreachable in /var/www/api/get_contents.php on line 2
The code I am using to do this is as follows:
<?php
$contents = file_get_contents("http://www.google.com/");
echo $contents;
?>
It seems like I need to set the proxy for php
to get the contents, where do I set this?