Quantcast
Channel: Error while trying to parse a YouTube search feed - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Error while trying to parse a YouTube search feed

$
0
0

I'm using SimpleXML to parse a YouTube search feed. I want to get the first result in the feed after searching for a term. Right now my code looks like this:

set_time_limit(0);// Include needed filesrequire_once "config.php";$xml = simplexml_load_file('http://gdata.youtube.com/feeds/base/videos?q=V.I.P.+KE%24HA&client=ytapi-youtube-search&v=2');print_r($xml->entry[0]->link);

The output for the code above is:

SimpleXMLElement Object(    [@attributes] => Array        (            [rel] => alternate            [type] => text/html            [href] => http://www.youtube.com/watch?v=TveGAmLdn8k&feature=youtube_gdata        ))

How can i get the value of "href" ?

Thank you.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images