PHP/cURL - Only able to query local websites - Help.?

Jaypoc

New member
I was having trouble with an XML parsing script and found the issue to be CURL. Using the code below to test cURL, I tried to load both locally hosted sites and remotely hosted sites. The local sites loaded right away while the remote sites return the error, "couldn't connect to host" (I tried many including "http://www.google.com/"

When I run CURL from a bash shell, it works regardless of what site I call.

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.mysite.com');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$contents = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if($contents) {
echo $contents;
} else {
echo curl_error($ch);
}

curl_close($ch);
?>

In addition, I don't see any errors in the apache logfiles. What could be blocking the requests? Is there additional configuration for cURL that I can't find that would enable/disable remote requests?

From my PHPINFO:
cURL support enabled
libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
 
Back
Top