我正在使用简单的 html dom 来解析 iTunes 预览页面
当我将 URL 放入代码 [download]url[/download] 时,一切正常,但是当我有 2 个或更多 [download]url[/download] 代码时,出现错误
致命错误:无法在第 80 行的 /var/.../simple_html_dom.php 中重新声明 file_get_html()(之前在 /var/.../simple_html_dom.php:65 中声明)
function download_link($link){
$file=ROOT_DIR."/engine/data/obmennik.php";
include '/var/.../simple_html_dom.php'; //ПАРСИНГ
require($file);
$site=parse_url($link);
$domain=$site['host'];
$itunes = file_get_html($link); //ПАРС
$image = $itunes->find('img.artwork[width=175]',0); //ПАРС
$e = $itunes->find("div.price", 0);
$u = $itunes->find("h1", 0);
$star = $itunes->find("div.rating", 0);
$un = $itunes->find("div.fat-binary-blurb", 0);
$dt=date('Y-m-d [H:00]');
if(array_key_exists($domain,$link_arr)){
$link="\n".'<br><a title="Скачать файл c '.$domain.'" rel="nofollow" target="_blank" href="http://li.ru/go?'.$link.'"><div style="-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;background: #DCDCDC;"><table><tr><td width="35%"><img class="its_small" src=\"'.$image->src.'\" /></td><td width="65%" valign="middle" align="center"><span style="font-size:16px; font-weight: bold;"> '.iconv("UTF-8","cp1251",$u->plaintext). '<br> [iTunes Link, '.iconv("UTF-8","cp1251",$e->plaintext).']</span><br><br>'.iconv("UTF-8","cp1251",$un->outertext).'<br>Рейтинг на: '.$dt.' '.$star->outertext.'</td></tr></table></div></a>';
} return $link; }
function decode_base64($code){
$code="[download]".trim(base64_decode($code))."[/download]";
return $code;
$itunes->clear();
}