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 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中
  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信
  • ¥30 Python调用dll文件输出Nan重置dll状态