I want to retrieve XML data related to weather. For that i use this API for it.
I tried to di it with CURL in PHP
This is my code
$url = "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=%22Kandy%22)";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); // get the url contents
$data = curl_exec($ch); // execute curl request
curl_close($ch);
$xml = simplexml_load_string($data);
print_r($xml);
But it retrieve blank output without any of text. Please help me to sortout this problem.
$data
empty ? – Oleg Butuzovcurl_init()
? – Syscallcurl_init()
?? – brombeer