curl_init not returning
Posted: Wed Jan 14, 2009 10:46 am
Yes I am a newb (to PHP).
The following code:
I never get a return from curl_init(). That is to say:
Though the browser does say done.
Not sure where to go with this? I had a different error before I had curl properly installed.
This is on a windows XP box behind a firewall.
The following code:
Code: Select all
<?php
$request = 'http://amazon.com';
//echo $request . '<br><br>';
echo 'Starting <br>';
$response = file_get_contents_proxy($request, 'pac.wachovia.net', 80);
echo 'Leaving file_get_contents_proxy() <br>';
echo htmlspecialchars($response, ENT_QUOTES);
echo 'Done <br>';
function file_get_contents_proxy($szURL, $szProxy, $iProxyPort = 8080)
{
echo 'Entering file_get_contents_proxy() <br>';
$pCurl = curl_init();
echo 'Completed curl_init() <br>';
curl_setopt($pCurl, CURLOPT_URL, $szURL);
curl_setopt($pCurl, CURLOPT_PROXY, $szProxy);
curl_setopt($pCurl, CURLOPT_PROXYPORT, $iProxyPort);
curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true);
echo 'Calling curl_exec() <br>';
$output = curl_exec($pCurl);
curl_close($pCurl);
return $output;
}
?>
Code: Select all
Starting
Entering file_get_contents_proxy()Not sure where to go with this? I had a different error before I had curl properly installed.
This is on a windows XP box behind a firewall.