Page 1 of 1

curl_init not returning

Posted: Wed Jan 14, 2009 10:46 am
by ed4becky
Yes I am a newb (to PHP).

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;
}
?>
 
I never get a return from curl_init(). That is to say:

Code: Select all

Starting
Entering file_get_contents_proxy()
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.

Re: curl_init not returning

Posted: Wed Jan 14, 2009 11:26 pm
by novice4eva
Try enabling the error, maybe it will give us some hint

Code: Select all

 
       //TO ENABLE ERROR REPORTING
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
 

Re: curl_init not returning

Posted: Fri Jan 16, 2009 9:46 am
by ed4becky
Thanx, that showed me that the curl_init() is still not found.

I'll keep looking.

Re: curl_init not returning

Posted: Fri Jan 16, 2009 12:17 pm
by RobertGonzalez
Have you restarted your web server to make sure the installation is actually being brought in?

Re: curl_init not returning

Posted: Tue Jan 27, 2009 12:21 pm
by ed4becky
I had my extension dir set wrong