Activity Stream
48,167 MEMBERS
6778 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1.     
    #1
    You can call me G

    Default [PHP] Getting the TV Show Banners from TheTVDB

    Made this last night. Quite handy and can be integrated with a blog/forum. Postting the function here. Do update if you have an improved code

    ATM, the function would search for the TV Show in the TheTVDB database, and if found will return the banner image link uploaded to lulzimg.com

    PHP Code: 
    function getBanner($title){
        if(
    preg_match("/[a-zA-Z0-9.]+S[0-9]+E[0-9]+|[A-Za-z0-9.]+20[0-9.]+/"$title$match)){
            
    $showname trim(str_replace("."" "$match[0]));
            
    $showname trim(preg_replace("/S[0-9]+E[0-9]+/"""$showname));
            
    $url "http://thetvdb.com/api/GetSeries.php?seriesname=".urlencode($showname);
            
    $page postHost($url);
            if(
    preg_match("/graphical\/[a-z0-9A-Z.\-]+/"$page$match)){
                
    $img postHost("http://www.lulzimg.com/upload.php?submit=lulz&url=http://thetvdb.com/banners/$match[0]");
                
    //echo $img;
                
    preg_match_all("/http:\/\/lulzimg.com\/[a-z0-9]+\/[a-z0-9A-Z.]+/"$img$matches);
                
    $imageUrl $matches[0][1];
                return 
    $imageUrl;
            }
        }

    Please do note that the code above considers that the title of the show is in Scene Release format..

    Also note, that the postHost function is a simple function which uses curl to post requests to TheTVDB. UTL and AutoUL users have that function in the script.

    Ex:
    The.Best.Thing.I.Ever.Ate.S03E03.Regional.Favorite s.HDTV.XviD-MOMENTUM

    Hope that helps.

    Regards,
    gunda316
    Gaurav Reviewed by Gaurav on . [PHP] Getting the TV Show Banners from TheTVDB Made this last night. Quite handy and can be integrated with a blog/forum. Postting the function here. Do update if you have an improved code :) ATM, the function would search for the TV Show in the TheTVDB database, and if found will return the banner image link uploaded to lulzimg.com function getBanner($title){ if(preg_match("/+S+E+|+20+/", $title, $match)){ $showname = trim(str_replace(".", " ", $match)); $showname = trim(preg_replace("/S+E+/", "", $showname)); Rating: 5



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    sborg.us
    Great job

  4.     
    #3
    You can call me G
    Quote Originally Posted by V3g3t4 View Post
    Great job
    Thnx V3g3t4



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  5.     
    #4
    Retired NinJa
    Website's:
    loledhard.com
    sexy thanks I wanted to have that. Its good



    You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!

  6.     
    #5
    Banned
    Website's:
    solarfit4la.org xenspeed.net
    Good job bro...It is working fine...Thanks for you handy coding.

  7.     
    #6
    mmm mmm!
    Well done mate
    HATERS GONNA probably bring up some valid points considering I am an ignorant little twat so far up my own ass that i blame my problems on everyone and if you criticize me you're automatically wrong.

  8.     
    #7
    You can call me G
    Quote Originally Posted by humour View Post
    sexy thanks I wanted to have that. Its good
    Quote Originally Posted by gtaclub View Post
    Good job bro...It is working fine...Thanks for you handy coding.
    Quote Originally Posted by mrsandvik View Post
    Well done mate

    NP.. I needed this myself



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  9.     
    #8
    Retired NinJa
    Website's:
    loledhard.com
    Here is the whole running PHP code. If u dont know how to make it work after seeing gundas post. I have just added the wrapper around the function Gunda


    PHP Code: 
    <?
    function getBanner($title)
    {
        if(
    preg_match("/[a-zA-Z0-9.]+S[0-9]+E[0-9]+|[A-Za-z0-9.]+20[0-9.]+/"$title$match)){
            
    $showname trim(str_replace("."" "$match[0]));
            
    $showname trim(preg_replace("/S[0-9]+E[0-9]+/"""$showname));
            
    $url "http://thetvdb.com/api/GetSeries.php?seriesname=".urlencode($showname);
            
    $page postHost($url"""");
            if(
    preg_match("/graphical\/[a-z0-9A-Z.\-]+/"$page$match)){
                
    $img postHost("http://www.lulzimg.com/upload.php?submit=lulz&url=http://thetvdb.com/banners/$match[0]""""");
                
    //echo $img;
                
    preg_match_all("/http:\/\/lulzimg.com\/[a-z0-9]+\/[a-z0-9A-Z.]+/"$img$matches);
                
    $imageUrl $matches[0][1];
                return 
    $imageUrl;
            }
        }

    function 
    postHost($url)
    {
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL$url);
        
    curl_setopt($chCURLOPT_COOKIESESSION1);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_CONNECTTIMEOUT60);
        
    curl_setopt($chCURLOPT_FOLLOWLOCATION1); 
        
    curl_setopt($chCURLOPT_TIMEOUT60);
        
    curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)");
        
    $source_code curl_exec($ch);
        
    curl_close($ch);
        return 
    $source_code;
    }
    if (empty(
    $_POST))
    {
    ?>
    <form method=post>
    <input type="text" name="img" />
    <input type="Submit" value="Submit" />
    </form>
    <?PHP
    }
    else
    {
    $imggetBanner($_POST['img']);
    echo 
    "<B>$img</B><BR/><BR/>";
    echo 
    "<img src=\"$img\" />";
    }
    ?>
    If you dont know how to run it than plz dont use it

    Note: Not all the release name would work. Most of them work tho

    Thanks Gunda u are charm



    You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!

  10.     
    #9
    You can call me G
    Quote Originally Posted by humour View Post
    Here is the whole running PHP code. If u dont know how to make it work after seeing gundas post. I have just added the wrapper around the function Gunda


    PHP Code: 
    <?
    function getBanner($title)
    {
        if(
    preg_match("/[a-zA-Z0-9.]+S[0-9]+E[0-9]+|[A-Za-z0-9.]+20[0-9.]+/"$title$match)){
            
    $showname trim(str_replace("."" "$match[0]));
            
    $showname trim(preg_replace("/S[0-9]+E[0-9]+/"""$showname));
            
    $url "http://thetvdb.com/api/GetSeries.php?seriesname=".urlencode($showname);
            
    $page postHost($url"""");
            if(
    preg_match("/graphical\/[a-z0-9A-Z.\-]+/"$page$match)){
                
    $img postHost("http://www.lulzimg.com/upload.php?submit=lulz&url=http://thetvdb.com/banners/$match[0]""""");
                
    //echo $img;
                
    preg_match_all("/http:\/\/lulzimg.com\/[a-z0-9]+\/[a-z0-9A-Z.]+/"$img$matches);
                
    $imageUrl $matches[0][1];
                return 
    $imageUrl;
            }
        }

    function 
    postHost($url)
    {
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL$url);
        
    curl_setopt($chCURLOPT_COOKIESESSION1);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_CONNECTTIMEOUT60);
        
    curl_setopt($chCURLOPT_FOLLOWLOCATION1); 
        
    curl_setopt($chCURLOPT_TIMEOUT60);
        
    curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)");
        
    $source_code curl_exec($ch);
        
    curl_close($ch);
        return 
    $source_code;
    }
    if (empty(
    $_POST))
    {
    ?>
    <form method=post>
    <input type="text" name="img" />
    <input type="Submit" value="Submit" />
    </form>
    <?PHP
    }
    else
    {
    $imggetBanner($_POST['img']);
    echo 
    "<B>$img</B><BR/><BR/>";
    echo 
    "<img src=\"$img\" />";
    }
    ?>
    If you dont know how to run it than plz dont use it

    Note: Not all the release name would work. Most of them work tho

    Thanks Gunda u are charm
    Thnx humour.. I was too lazy to add that



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  11.     
    #10
    Member
    Website's:
    tufos.net
    haha thanks gunda, just integrated it to Yawn' script

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Selling] Adspace 2000+ Users Per Day All Kind Of Banners Legal Banners
    By fatal1ty992 in forum Completed Transactions
    Replies: 4
    Last Post: 22nd Nov 2011, 08:41 PM
  2. banners
    By blackheart in forum Graphics Area
    Replies: 0
    Last Post: 17th Sep 2011, 07:43 PM
  3. can someone show me a tut..
    By ibby in forum Graphics Area
    Replies: 1
    Last Post: 5th May 2011, 09:47 PM
  4. [Buying] banners
    By MrPeanut420 in forum Completed Transactions
    Replies: 10
    Last Post: 28th Mar 2010, 05:39 AM
  5. Show IP
    By Santocool in forum General Discussion
    Replies: 15
    Last Post: 26th Feb 2010, 11:52 PM

Tags for this Thread

BE SOCIAL