Forum Moderators: coopster

Message Too Old, No Replies

Youtube previews via INZU API

         

optik

11:12 am on Mar 25, 2011 (gmt 0)

10+ Year Member



Hi

I'm using the INZU API to build a site and want to access youtube video thumbnails for previews, here is my code, but it isn't working.



$xml = simplexml_load_file("http://api.inzu.net/xml/my_site/my_site.xml?api_pass={$api_pass}&api_key={$key}&zone=video&pagenum=1&rows_page=100&order=date&order_type=DESC");


foreach ($xml->entry as $entry) {

$video=$entry->video;

$image_you=explode("/",$entry->video);
$image_you=explode("&",$image_you[4]);
$image_you=explode("?",$image_you[0]);

$video_archive.=<<<EOD
<span>

<a href="video.html?entry_id={$entry['entry_id']}" ><img class="video_img" src="http://img.youtube.com/vi/{$image_you[0]}/2.jpg" width="60" border="0" /></a>

<span class="main_body_TXT" >
<a href="video.html?entry_id={$entry['entry_id']}" ><strong>{$entry->title}</strong></a><br/>
{$entry->description}<br/>
<strong>Length:</strong>{$entry->duration}<br/>
</span>
</span>
<hr/>
EOD;

}

coopster

1:09 am on Apr 2, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



here is my code, but it isn't working.


You're not giving us much to go on here, optik. :)
What do the logs say? Any errors?

optik

11:34 am on Apr 7, 2011 (gmt 0)

10+ Year Member



The image just isn't displaying, this... $entry->video ...is basically a youtube embed code from youtube, I just need a reliable way of accessing the youtube thumbnail from a youtube embed code if that is even possible.

eelixduppy

2:32 pm on Apr 7, 2011 (gmt 0)



What is the actual generated HTML code from this code? I would see if the output from this code gives you the image URI that you are actually looking to see.

rocknbil

3:51 pm on Apr 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, and do you get anything when you add

echo $xml;

If you do, you can examine the response manually.