views:

29

answers:

2

I have a project that I need to add many many videos, some of which are TED.com videos. Is there an easy way I can perform an AJAX, JSON, or cURL request to obtain this information? This information does not seem to be in the embed object.

A: 

A way is load the html page with curl and get the data using DOM.

CrociDB
that doesnt sound easy.
Talvi Watia
It's not as hard as it sounds. You can use this library for parsing html: http://sourceforge.net/projects/simplehtmldom/ - I think the main problem is loading the page. It will, probably, kill your app performance. =\
CrociDB
+1  A: 

The site has an RSS feed that contains a lot of information, currently covering the last 112 lectures. For example, you could list direct links to the videos like this:

$url = 'http://feeds.feedburner.com/tedtalks_video';
$sxml = new SimpleXMLElement(file_get_contents($url));
foreach ($sxml->xpath('//item') as $item) {
    $video_link = $item->enclosure->attributes()->url;
    echo date('Y-m-d', strtotime($item->pubDate)) . '<br />'
       . $item->title . '<br />'
       . $item->description . '<br />'
       . '<a href="' . $video_link . '">' . $video_link . '</a><br />'
       . '------------------<br />';
}
GZipp
That is was I need. Thanks!
Talvi Watia