Code: Select all
$search_url = "http://www.google.com/";
if (function_exists("curl_init")) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_PROXY, "itgproxy:80");
curl_setopt ($ch, CURLOPT_URL, $search_url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$response = curl_exec($ch);
curl_close($ch);
var_dump( $response );
}Code: Select all
$search_url = "http://www.google.com/";
if (function_exists("file_get_contents")) {
$opts = array(
'http'=>array(
'method'=>"GET",
'proxy'=>"itgproxy:80",
)
);
$context = stream_context_create($opts);
$response = file_get_contents($search_url, false, $context);
var_dump( $response );
}1. Why would file_get_contents() not recognize http?PHP Warning: file_get_contents(http://www.google.com/) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 502 Proxy Error ( The Uniform Resource Locator (URL) does not use a recognized protocol. Either the protocol is not s in C:\\...\\NetworkTest.php on line 26
2. What does it mean by Either the protocol is not s in <file name>
Thanks
Jeff in Seattle