So does the following give you that error message?
$test = file_get_contents('http://www.cnn.com');
If so, it's not a coding, but a server configuration problem. By server configuration, I don't just mean the php.conf file... there could be DNS or other problems on the server.
Just out of curiosity, if you do a phpinfo(), is http listed under 'Registered PHP Streams' (probably the last row of the very first table). Also, what is 'allow_url_fopen' set to?
Just in case it IS a DNS error, what does the following do?
$test = file_get_contents('http://64.236.16.52'); // cnn.com = 64.236.16.52