Instruction:-

1. You can take an array at the place of $place_Name.
2. If any place temperature not shown this mean Google have no value that time
3. This an array run in for each
4. There is using if and else condition
5. because some city/state/country name does not support xml
6. Just copy and paste the code definately run
7. There is no error in file
8. Just change your place name on here


//Copy code from here.

$place_Name = 'chandigarh';

$googleApiLink= "http://www.google.com/ig/api?weather=".$place_Name."&hl=en";
$xmlFunctionForDataLoad = @simplexml_load_file($googleApiLink);

if($xmlFunctionForDataLoad)
{
$gettingWeatherData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}
else
{
$url = file_get_contents($googleApiLink);
$xmlFunctionForDataLoad = iconv("iso-8859-1", "utf-8", $url);
$xmlFunctionForDataLoad = simplexml_load_string($xmlFunctionForDataLoad);
$information = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}

echo ucfirst($place_Name).' => '.$getData[0]->temp_c['data'].'°C';

//End of the code on there

1. Following given the document of this code.
2. You can read instruction and download code from below
3. See the following document and download