Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have used the yahoo weather php script which woked great.After few minutes it stopped working and showing below error .I couldn't understand why it suddenly stopped working

Warning: file_get_contents(http://query.yahooapis.com/v1/public/yql? q=select%20*%20from%20geo.places%20where%20text%3D%22Limit Exceeded%22&format=xml)  [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 505 HTTP  Version Not Supported in /home/tollyday/public_html/weather.php on line 25

I used below code

$city="Bangalore";
$result1 = file_get_contents("http://query.yahooapis.com/v1/public/yql? q=select%20*%20from%20geo.places%20where%20text%3D%22$city%22&format=xml");
 $xml1 = simplexml_load_string($result1);
  $woeid=$xml1->results->place->woeid;

if($woeid!="")
{
 $fetchData = file_get_contents("http://weather.yahooapis.com/forecastrss? w=$woeid&u=c");
 $xmlData = simplexml_load_string($fetchData);
 $location = $xmlData->channel->xpath('yweather:location');


if(!empty($location))
{

foreach($xmlData->channel->item as $data)
{
$current_condition = $data->xpath('yweather:condition');
$forecast = $data->xpath('yweather:forecast');
$current_condition = $current_condition[0];
echo "
<table>
<tr>
<td>
<span style=\"font-weight:bold;\">{$location[0]['city']}
</span>|&nbsp;
<img src=\"http://l.yimg.com/a/i/us/we/52/{$current_condition['code']}.gif\" width=\" 23\" style=\"margin-bottom:-1px;margin-top:-1px;vertical-align: middle;\"/>
 {$current_condition['temp']}&#176
{$current_condition['text']}

</td>
</tr></table>
";
 }
 }
 else
{
echo "<h1>please try a different City.</h1>";
 }


}
else 
{
echo "<h1>Please try a different City.</h1>";
}
share

migration rejected from stackoverflow.com Jul 5 '13 at 9:25

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Sathya Jul 5 '13 at 9:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here, but can be asked on Stack Overflow." – Sathya
If this question can be reworded to fit the rules in the help center, please edit the question.