How to check whether any data is returned in Object $twitter_xml for query abc or its empty?
Following is the code:
$url="http://search.twitter.com/search.rss?q=abc";
$twitter_xml = simplexml_load_file($url);
How to check whether any data is returned in Object $twitter_xml for query abc or its empty?
Following is the code:
$url="http://search.twitter.com/search.rss?q=abc";
$twitter_xml = simplexml_load_file($url);
I'm not sure what Twitter returns, but you should be able to do an isset() on a value you expect to exist.
See http://php.net/manual/en/function.isset.php
E.g.
if(isset($twitter_xml->name))
{
// XML has a 'name' element
}
else
{
// No 'name' element
}