this script does not work on that same site:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://www.randolphcollege.edu’);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, ‘read_header’);
curl_setopt($ch, CURLOPT_WRITEFUNCTION, ‘read_body’);
curl_exec($ch);
if ($error = curl_error($ch)) {
echo “Error: $error
\n”;
}
function read_header($ch, $string)
{
$length = strlen($string);
echo “Header: $string
\n”;
return $length;
}
function read_body($ch, $string)
{
$length = strlen($string);
echo “Received $length bytes
\n”;
return $length;
}
echo file_get_contents(“http://www.yahoo.com/index.html”);
?>
Actually, it works, it just returns the following:
Error: Couldn’t resolve host ‘www.randolphcollege.edu’
It sounds me like you have a server configuration issue and the server is refusing to contact external sites.
This works from the command line: curl http://www.google.com/
returns the source from that page.
also, ping, dig, and nslookup are working fine from that server.
Sever configuration is not my area of expertise but it looks like cUrl isn’t enabled for PHP if it will run from commandline but not from a script. So it’s either a PHP setup issue or something that sits between PHP & the server shell is mis-configured and is blocking external calls.
I’ll see if I can get a few of the regulars with more server admin experience to drop into this thread and lend a hand.
Can you create a phpinfo page and link that to this post so we can see what’s currently configured? Just create a page called phpinfo.php which contains the following line:
<?php phpinfo() ?>
And upload it to your site via FTP. This will tell us a little about how your server is configured and whether or not cURL is enabled.
I’d appreciate that greatly. FYI when I run the php script above with an ip address in it, it returns valid headers, which suggests that cURL is enabled and working fine. (e.g. the line curl_setopt($ch, CURLOPT_URL, ‘http://72.14.204.104’);)
additionally, this works fine inside PHP on that server:
print gethostbyname(‘bugs.php.net’);
returns “128.39.198.38”
Looking at your configuration, and reading your latest post about how cURL works via IP but not hostname, I’m at a total loss. I’d recommend posting your situation on either serverfault.com or superuser.com and seeing if a pro over there can help (then make sure you copy the solution over here for people who might need it as well).
The thing that bothers me the most is that this is an .edu site … some educational institutions have complex server setups that break WordPress very easily … I’m hoping you’re not in that boat, too.
Are you running an upgraded MU install? Or did you install 3,.0 fresh?
You should download the Core Control plugin, http://wordpress.org/extend/plugins/core-control/, and test out the HTTP transports.
+1 to Andrew’s suggestion.
If there’s a difference between using the domain and the IP, and coupled with the fact that it’s a subdoman, I’d say it sounds like DNS. Might be time for serverfault, as suggested.
It’s a fresh install of MU.