I am doing an ajax call from my webpage to get response from getWeather.php page in JSON format. Sometimes i get result but mostly i don't. But whenever i browse this link, it always give me result in JSON format. Am i doing something wrong in my getWeather.php?
https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%27lahore%27)%20AND%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
getWeather.php implementation:
<?php
$city = $_GET['city'];
echo file_get_contents("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%27".$city."%27)%20AND%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=");
?>
{"query":{"count":0,"created":"2017-01-03T04:50:27Z","lang":"en-US","results":null}}
Yahoo weather API has a problem. You can check on Yahoo; https://developer.yahoo.com/weather/ same problem on own app.