1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Beginner Need Help I tired :(

Discussion in 'PHP & Perl' started by rexa5512, Mar 4, 2014.

  1. rexa5512

    rexa5512 Newbie

    Joined:
    Feb 3, 2013
    Messages:
    13
    Likes Received:
    0
    I've tried various kinds to be able to resolve the problem for me but I did not get anything, in fact I've been using the services of Fiverr but my problem was not finished well,


    I have a code youtube rss feed

    PHP:
    $search 'funny video';//Search Term
    $file file_get_contents('hxxp://gdata.youtube.ccom/feeds/base/videos?q='.$search.'&client=ytapi-youtube-search&v=2'); // please change xx to tt and edit ccom to normaly
    $rss = new SimpleXMLElement($file);
    $limit '10'//Videos Limit to display
    $ctr '0';
    foreach(
    $rss->entry as $idx => $key)
    {
    if(
    $ctr == $limit)
    {
    break;
    }
    else{
    echo 
    '<div id="video">';
    echo 
    '<p class="title">'.$key->title.'</p>';
    echo 
    '<p class="video">'.$key->content.'</p>';
    echo 
    '</div>';
    $ctr++;
    }
    }


    That result is 10 video youtube


    can anyone help me to get that Title Video so when we try like this


    example like this


    we search 'funny video' and the result is


    1. funny video bla..bla 1


    2. funny video bla..bla 2


    3. funny video bla..bla 3


    4. funny video bla..bla 4


    and more


    I need When we click 'funny video bla..bla 3' will go to my search page as 'funny video bla..bla 3'


    Please help me
    I try this 3 month but not change anything :( :( :(
     
  2. rexa5512

    rexa5512 Newbie

    Joined:
    Feb 3, 2013
    Messages:
    13
    Likes Received:
    0
    anyone ?
    can give solutions :(
     
  3. NichoTheMan

    NichoTheMan Newbie

    Joined:
    Mar 6, 2014
    Messages:
    7
    Likes Received:
    0
    Not exactly sure if this is what you wanted but see if this is what you wanted:
    (im not allowed to post urls since im a new member so add what i have removed from the url for it to work.)
    Code:
    <?php
        $search = 'funny video';
        $amount = '10';
        $search = str_replace(' ', '+', $search);
          $url="*ADD THE GDATA URL HERE*/feeds/api/videos?q='".$search."'&format=5&max-results=".$amount."&v=2&alt=json";
        
        $get = file_get_contents($url);
        $decode = json_decode($get, TRUE); // TRUE for in array format
        $i='0';
        foreach ($decode['feed']['entry'] as $entry) {
            $i++;
            echo '#'.$i.' <a href="'.$entry['link'][0]['href'].'">'.$entry['title']['$t'].'</a><br />';
        }
    ?> 
    
     
    Last edited: Mar 6, 2014
  4. rexa5512

    rexa5512 Newbie

    Joined:
    Feb 3, 2013
    Messages:
    13
    Likes Received:
    0
    Thanks I will Try this :)

     
  5. rexa5512

    rexa5512 Newbie

    Joined:
    Feb 3, 2013
    Messages:
    13
    Likes Received:
    0
    can you help
    how I can get That descriptions, Rating, View ?