Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8063463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:02:44+00:00 2026-06-05T11:02:44+00:00

I am pulling in some youtube video thumbnails into my page with the following:

  • 0

I am pulling in some youtube video thumbnails into my page with the following:

<img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg"></img>

(using a Joomla module to supply the youtube video ID’s at $youtubelist)

Along with the youtube thumbnail, I also want to pull in the youtube video ‘title’ & ‘description’.

How do I do this?

Thanks

[edited below]

This is my code & I want to place the title above the tag:

<?php
$youtubelist    = explode( ',', $youtubecode );
$numyoutube     = count($youtubelist);
//Get duplicate module or not
$a=1;
foreach ($list as $item) :
    //$total=$a;
    $enddbid = $item->id;
        if ($ytslide==$enddbid) {$nummod=$a;}
    $a++;   
endforeach;
?>
<div id="videos">
    <div style="padding-left: 2px; padding-right: 2px;padding-bottom:2px;">
    <?php for ($i=0; $i<$numyoutube; $i++) { ?>
        <a href="#">
            <img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg"></img>
        </a>
    <?php } ?>
    </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:02:48+00:00Added an answer on June 5, 2026 at 11:02 am

    You can get information about a particular youtube video using this piece of code:

    $url = "http://gdata.youtube.com/feeds/api/videos/$youtubeid?v=2";
    $res = file_get_contents($url);
    

    This will return Atom XML with the full metadata of the video, including title, author, dates, keywords, etc., etc. Read the <title> element of the response to get what you need. So this code will give you what you’re after:

    $data = new DOMDocument();
    $res = preg_replace('/>\s+</','><', $res);
    $root = $req->loadXML($res);
    $tnodes = $root->getElementsByTagName('title');
    $tn = $tnodes->item(0);
    $title = $tn->firstChild->nodeValue;
    

    With your code you’ll need to have something like this:

    <div id="videos">
        <div style="padding-left: 2px; padding-right: 2px;padding-bottom:2px;">
        <?php
            $data = new DOMDocument();
            for ($i=0; $i<$numyoutube; $i++) {
                $url = "http://gdata.youtube.com/feeds/api/videos/" . $youtubelist[$i] . "?v=2";
                $res = file_get_contents($url);
                $res = preg_replace('/>\s+</','><', $res);
                $root = $req->loadXML($res);
                $tnodes = $root->getElementsByTagName('title');
                $tn = $tnodes->item(0);
                $title = $tn->firstChild->nodeValue;
            ?>
            <a href="#">
                <div style="float:left">
                    <?php echo $title; ?>
                    <br/>
                    <img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg" />
                </div>
            </a>
        <?php } ?>
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im pulling back images from youTube images like http://img.youtube.com/vi/9KPCO5ENlmw/0.jpg and what I see in
Currently I'm pulling through a number of videos from the following YouTube channel: www.youtube.com/user/UCASonline
I have a page which is Https, I am pulling some rss feeds using
Im pulling some data out of my webdb, turning it into html and wanting
I'm pulling some info from a database then putting it into a DIV and
I am having some trouble pulling RSS off of blogger page and publishing it
I'm pulling some RSS feeds in from YouTube which have invalid UTF8. I can
I am pulling some data from a mysql table via the following: $result =
I am pulling some data from mysql database using PHP, now I would like
I am pulling some of my code into a folder through svn externals. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.