Help with script

Discussion in 'PHP' started by BABUPATHAN, Jul 16, 2008.

  1. #1
    i have this script to fetch youtube videos and display in a list and also to play

    but it is using .htaccess rewrite rule to write new pages names

    when i shifted my script to a free host (Myownfreehost.com) then it stoped to display videos, it just displaying Web page logo to Search Box and not showing videos thumbnails below,

    any one can help me to sort out this problem?

    codes are below:


    <?




    // firefox denetimi ...
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
    $t =1; }
    if(!isset($t)){ die('Firefox yükle öyle gel :)');}

    ob_start();

    // ayarlar _____________________________________________________________________
    $ydev_id = "bXhwh86JXLY"; // youtube'ye üye olup kendinize bir developer id alýn .
    $per_page = "10"; // bir sayfada kaç tane video gösterilecek max 100 (not:Tema max 15tane video için yapýlmýþtýr .)
    $firstword = "News";
    $sqlsave = "0"; // çýkan sonuçlarý mysql'ye kayýt etmesi için bu deðeri "1" yapýn .
    //____________________________________________________________________________

    // tr karakter ayarlarý
    function stren($ds){
    $ds = trim($ds);
    $bl = array('Ç','ç','Ð','ð','ý','ı','ü','ç','ÅŸ','Ç','Ö','ö','Ý','Ö','ö','Þ','þ','Ü','ü','_'); // vs...
    $ky = array('C','c','G','g','i','ý','ü','ç','þ','Ç','Ö','ö','I','O','o','S','s','U','u',' ');
    $snc = str_replace($bl,$ky,$ds);
    return $snc;}

    function linken($ds){
    $ds = trim($ds);
    $bl = array('Ç','ç','Ð','ð','ý','Ý','Ö','ö','Þ','þ','Ü','ü',' ','?','"');
    $ky = array('C','c','G','g','i','I','O','o','S','s','U','u','_','','');
    $snc = str_replace($bl,$ky,$ds);
    return $snc;}

    require("class.xmltoarray.php");

    $searchwords = $_GET['word'];
    $searchwords = str_replace(" ","%20",$searchwords);
    $page = $_GET['page'];
    $w = $_GET['w'];
    $n = $_GET['n'];

    if(empty($page)){ $page = "1"; }
    if(empty($searchwords)){ $searchwords = "$firstword"; }

    $searchurl = file_get_contents("http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag&dev_id=$ydev_id&tag=$searchwords&page=$page&per_page=$per_page");

    $xmltoarray = new XmlToArray($searchurl);
    $arrayData = $xmltoarray->createArray();

    ?>
    <html>
    <head>
    <title>ivQn - Youtube @ Api</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
    </head>
    <LINK href="style.css" type=text/css rel=stylesheet >

    <body background="images/bg-slice.gif" topmargin="0">
    <br><br>
    <div id="demo">
    <div class="dialog">
    <div class="content">
    <div class="t"></div>
    <div align="center">
    <p> <br>
    <br>
    <h1>LOGO'nuz Buraya</h1>
    <br>
    <br>
    <form method="GET" action="seo.search.php">
    <input type="text" name="word" size="30" value="<?=$searchwords;?>" style="border: 1px solid #000000; font-family: georgia;font-size:14px;">
    &nbsp;
    <input type="submit" value="&nbsp;&nbsp;&nbsp;ARA&nbsp;&nbsp;&nbsp;" style="border: 1px solid #000000; font-family: georgia;font-size:14px; color: #00FF00; background:#FFFFFF;">
    </form>
    <br>
    <br>
    <?

    foreach ($arrayData['ut_response']['video_list'] as $total) {
    if($total['total'] > 1000){ $q="1000"; }else{ $q = $total['total'];}
    $totalpages = ($q / $per_page) + 1 ;

    echo "<h1>Toplam Youtube Sonucu : <b>".$total['total']."</b> . // Toplam indexlenebilen videolar : <b>".($totalpages - 1)."</b> * <b>(".$per_page.")</b> = <b>".(($totalpages - 1)*$per_page)."</b> </h1>";

    }

    ?></p>
    </div>
    </div>
    <div class="b">
    <div></div>
    </div>
    </div>


    <div id="demo">
    <div class="dialog">
    <div class="content">
    <div class="t"></div>
    <br>
    <div class="table.1" align="center"> <div class="table.2"><br>
    <br>

    <?
    if(isset($w)){
    $n = str_replace("%20"," ",$n);
    ?>

    <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg_trans_white.png">
    <tr>
    <td height="19"><div align="center"><?="<a href=\"$w-izle-".linken($n).".html\">".stren($n)."</a>";?>
    </div></td>
    </tr>
    </table><br>


    <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/<?=$w;?>&autoplay=1">
    </param><param name="wmode" value="transparent"></param>
    <embed src="http://www.youtube.com/v/<?=$w;?>&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350">
    </embed>
    </object>


    <? }else{ ?>

    <? // Burasi listeleme
    foreach ($arrayData['ut_response']['video_list'][0]['video'] as $value) {

    if($sqlsave == '1'){ require("write.to.mysql.php"); }

    ?>
    <table width="70%" border="0" cellpadding="0" cellspacing="0" background="images/bg_trans_white.png">
    <tr>
    <td colspan="3">&nbsp;</td>
    </tr>
    <tr> <td>
    <table width="93%" border="0" align="center" cellpadding="0" cellspacing="0" >
    <tr>
    <td width="137" rowspan="2">
    <?="<a href=\"".$value['id']."-izle-".linken($value['title']).".html\"><img src=\"".$value['thumbnail_url']."\" border=\"0\"></a>";?></div></td>
    <td width="1" rowspan="2"></td>
    <td width="337"><e1><u>
    <?="<a href=\"".$value['id']."-izle-".linken($value['title']).".html\">".stren($value['title'])."</a>";?>
    </u></e1> </td>
    </tr>
    <tr >
    <td ><e2>
    <?=$value['view_count']." - kez izlenmiþ";?>
    <br>
    <?=$value['rating_avg']." / 5.00 - Populerlik (".$value['rating_count']." kiþi oylamýþ)";?>
    <br>
    </e2></td>
    </tr>
    <tr>
    <td colspan="3"><e3>Anahtar Kelimeler :
    <?=stren($value['tags']);?>
    </e3>&nbsp;</td>
    </tr>
    <tr>
    <td colspan="3"><e3> <?=$wr;?> </e3></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <br>
    <? }} ?>
    </div>
    </div>
    <br>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg_trans_white.png">
    <tr>
    <td height="19"><div align="center">
    <?

    if(!isset($w)){
    for($i=1; $i < $totalpages; $i++) { echo("<a href=".$_SERVER['PHP_SELF']."?word=$searchwords&page=$i><e3>$i.</e3></a>\r\n"); }
    }else{
    echo "<a href=\"".$_SERVER['PHP_SELF']."\">Geri Dön</a>";
    }?>
    </div></td>
    </tr>
    </table>

    <br>
    <br>
    <div align="center">
    <h1>Orhan Koc | All right reserved 2007 - Powered by Youtube API</h1>
    </div>
    </div>
    <div class="b">
    <div></div>
    </div>
    </div>
    </div>
    </body>
    </html>
    <? ob_end_flush(); ?>
     
    BABUPATHAN, Jul 16, 2008 IP
  2. sastro

    sastro Well-Known Member

    Messages:
    214
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #2
    Try to display your hosting phpinfo(). I think some free web host disable file_get_contents. You should move it to 000webhost or buy commercial hosting.
    Look at mine www.f1as.com
     
    sastro, Jul 16, 2008 IP
  3. wdillsmith

    wdillsmith Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If file_get_contents doesn't work, you can try using the curl library if that is installed.
     
    wdillsmith, Jul 17, 2008 IP
  4. BABUPATHAN

    BABUPATHAN Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    am not a good scripter so dont know how to check my host php info

    can u suggest me any specific free host which suit for my www.clipspk.com script
     
    BABUPATHAN, Jul 17, 2008 IP
  5. thenotself

    thenotself Peon

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    To check php info, make a new file (call it info.php) and inside just put the following code

    
    <?php
    phpinfo();
    ?>
    
    Code (markup):
    Then upload it and visit that file.
     
    thenotself, Jul 17, 2008 IP