Separate the lines out and introduce a try / catch block as follows :
try {
$url = "http://www.google.com/ig/api?weather=Moskva&hl=en";
$temp1 = file_get_contents($url);
$temp2 = utf8_encode($temp1);
$xml = simplexml_load_string($temp2);
echo $xml->weather->current_conditions->temp_c->attributes()->data;
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "
";
}
what happens then ?
Updated
Your response was due to the ip address your are coming from .... this was the response :
http://www.google.com/sorry/?continue=http://www.google.com/ig/api%3Fweather%3DMoskva%26hl%3Den
typing the response URL into a browser gives this :
Our systems have detected unusual traffic from your computer network.
This page checks to see if it's really you sending the requests, and
not a robot. Why did this happen?
IP address: 90.214.41.66 Time: 2012-01-06T21:35:24Z URL:
http://www.google.com/ig/api?weather=Moskva&hl=en
Enter the URL in a browser and complete the CAPTCHA - should be sorted then