doxd96148 2014-04-17 19:20
浏览 49
已采纳

在我的网站的脚本上错误PHP代码[关闭]

my script have an error on the line 132, so the cron ends with error, can you assist? I didn't made this script and the coder is not available anymore, so if someone can help me I will really appreciate

thank you


<?php
    include('/home/admin/domains/domain.com/public_html/admin/inc/connect.inc.php');
    require_once('/home/admin/domains/domain.com/public_html/inc/lastadd.php");
    echo RSS_Display("http://www.site.com/embedrss", 12);

?>

<?
$RSS_Content = array();
function RSS_Tags($item, $type)
{
        $y = array();
        $tnl = $item->getElementsByTagName("title");
        $tnl = $tnl->item(0);
        $title = $tnl->firstChild->textContent;

        $tnl = $item->getElementsByTagName("link");
        $tnl = $tnl->item(0);
        $link = $tnl->firstChild->textContent;

        $tnl = $item->getElementsByTagName("description");
        $tnl = $tnl->item(0);
        $description = $tnl->firstChild->textContent;

        $y["title"] = $title;
        $y["link"] = $link;
        $y["description"] = $description;
        $y["type"] = $type;

        return $y;
}


function RSS_Channel($channel)
{
    global $RSS_Content;
    $items = $channel->getElementsByTagName("item");
    // Processing channel
    $y = RSS_Tags($channel, 0);     // get description of channel, type 0
    array_push($RSS_Content, $y);
    // Processing articles
    foreach($items as $item)
    {
        $y = RSS_Tags($item, 1);    // get description of article, type 1
        array_push($RSS_Content, $y);
    }
}
function RSS_Retrieve($url)
{
    global $RSS_Content;
    $doc  = new DOMDocument();
    $doc->load($url);
    $channels = $doc->getElementsByTagName("channel");
    $RSS_Content = array();
    foreach($channels as $channel)
    {
         RSS_Channel($channel);
    }
}
function RSS_RetrieveLinks($url)
{
    global $RSS_Content;
    $doc  = new DOMDocument();
    $doc->load($url);
    $channels = $doc->getElementsByTagName("channel");
    $RSS_Content = array();
    foreach($channels as $channel)
    {
        $items = $channel->getElementsByTagName("item");
        foreach($items as $item)
        {
            $y = RSS_Tags($item, 1);    // get description of article, type 1
            array_push($RSS_Content, $y);
        }
    }
}
function RSS_Display($url, $size = 15, $site = 0)
{
    global $RSS_Content;
    $opened = false;
    $page = "";
    $site = (intval($site) == 0) ? 1 : 0;
    RSS_Retrieve($url);
    if($size > 0)
        $recents = array_slice($RSS_Content, $site, $size + 1 - $site);
    foreach($recents as $article)
    {
        $type = $article["type"];
        if($type == 0)
        {
            if($opened == true)
            {
                $page .="";
                $opened = false;
            }
            $page .="";
        }
        else
        {
            if($opened == false) 
            {
                $page .= "";
                $opened = true;
            }
        }
        $title = $article["title"];
        $link = $article["link"];
        $links[]=$link;
        $description = $article["description"];
        $page .= "";
        if($description != false)
        {
            $page .= "";
        }
        $page .= "";            
        if($type==0)
        {
            $page .="";
        }
    }
    if($opened == true)
    {   
        $page .="";
    }
    ?>
    <?
    foreach($links as $lnk) {

    $ch = curl_init();//start curl
    curl_setopt($ch, CURLOPT_URL, $lnk);             //curl Targeted URL
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);     
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);    
    $source = curl_exec($ch);

    $videoid_start = strpos($source,'http://www.traileraddict.com/emd/');
    $videoid_end = $videoid_start+60;

    $poster_start = strpos($source,'dir=');
    $poster_end = strpos($source,'.jpg" style="');

    $desc_start = strpos($source,'Upscale Font');
    $desc_end = strpos($source,'Tags:');

    $title_start = strpos($source,'<title>');
    $title_end = strpos($source,'</title>');

    $videoid_content="";
    $poster_content='';
    $desc_content='';
    $title_content='';

    /*HERE STATRTS THE Poster CODE*/
    for ($i=$poster_start;$i<$poster_end;$i++) {
        $poster_content .= $source[$i];
    }
    $poster_content= trim(str_replace('dir=','',$poster_content));


    /*HERE STATRTS THE Title CODE*/
    for ($i=$title_start;$i<$title_end;$i++) {
        $title_content .= $source[$i];
    }
    $title_content= trim(str_replace('<title>','',$title_content));
    $title_content= trim(str_replace(' - Trailer Addict','',$title_content));
    if (empty($title_content)) 
    {
    ?>
    <center>No Title</center>
    <?
    }
    if (empty($poster_content)) 
    {
        $contents = file_get_contents('/home2/playtwof/public_html/dailytrailers/posters/noposter.jpg');
        $title_poster = $title_content;
        $title_poster = trim(str_replace(' ','',$title_poster));
        $title_poster = trim(str_replace(':','',$title_poster));
        $title_poster = trim(str_replace("'","",$title_poster));
        $title_poster = trim(str_replace("&","",$title_poster));
        $fp = fopen('/home2/playtwof/public_html/dailytrailers/posters/'.$title_poster.'.jpg', 'w');
        fwrite($fp, $contents);
        fclose($fp);
    }
    else {
        $contents = file_get_contents('http://www.traileraddict.com'.$poster_content.'.jpg');
        $title_poster = $title_content;
        $title_poster = trim(str_replace(' ','',$title_poster));
        $title_poster = trim(str_replace(':','',$title_poster));
        $title_poster = trim(str_replace("'","",$title_poster));
        $title_poster = trim(str_replace("&","",$title_poster));
        $fp = fopen('/home2/playtwof/public_html/dailytrailers/posters/'.$title_poster.'.jpg', 'w');
        fwrite($fp, $contents);
        fclose($fp);
        }
    /*HERE ENDS THE Poster CODE*/
    /*HERE ENDS THE Title CODE*/
    /*HERE STATRTS THE Description CODE*/
    for ($i=$desc_start;$i<$desc_end;$i++) {
        $desc_content .= $source[$i];
    }
    $desc_content= trim(str_replace('Upscale Font','',$desc_content));
    $desc_content= trim(str_replace('<a href="/tags/hatchet">','',$desc_content));
    $desc_content= trim(str_replace('<span id="morelink" name="morelink"><a href="javascript:viewinfo();"><img src="/images/moreinfo.png" alt="More Trailer Details" border="0" align="absmiddle"></a>','',$desc_content));
    $desc_content= trim(str_replace('</div>','',$desc_content));
    $desc_content= trim(str_replace('" style="float:left; margin-top:2px;" border="0" />','',$desc_content));
    $desc_content= trim(str_replace('<span id="moredet" name="moredet" style="display:none;">','',$desc_content));
    $desc_content= trim(str_replace('<a href="javascript:lessinfo();"><img src="/images/lessinfo.png" alt="Hide Trailer Details" border="0" align="absmiddle"></a></a></span> <span id="morelink" name="morelink"><a href="javascript:viewinfo();"><img src="/images/moreinfo.png" alt="More Trailer Details" border="0" align="absmiddle"></a><br></span> </span>','',$desc_content)); $desc_content= trim(str_replace('<img src="/images/lessinfo.png" alt="Hide Trailer Details" border="0" align="absmiddle">','',$desc_content));
    $desc_content= trim(str_replace('<span id="morelink" name="morelink"><img src="/images/moreinfo.png" alt="More Trailer Details" border="0" align="absmiddle">','',$desc_content));
    if (empty($desc_content)) 
    {
    ?>
    <center>Sorry, No description for this trailer!<br /></center>
    <?
    }
    for ($i=$videoid_start;$i<$videoid_end;$i++) {
    if (is_numeric($source[$i]))
        $videoid_content .= $source[$i];
    }
        $desc_content= trim(str_replace("'","",$desc_content));
        $title_content = trim(str_replace("'",'',$title_content));
        $title_poster = trim(str_replace("'","",$title_poster));
        mysql_query("insert into trailer set titlu='$title_content',poster='$title_poster.jpg',descriere='$desc_content',video_id='$videoid_content',hits=1");
    }
}
?>
  • 写回答

1条回答 默认 最新

  • dsfgds4215 2014-04-17 19:23
    关注

    You have an error in this line - it begins with a single quote, and ends in a double quote:

    require_once('/home/admin/domains/domain.com/public_html/inc/lastadd.php");
                                         this should be a single quote------^
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么