1

シンプルな HTML DOM ライブラリを使用していて、エラーが発生しています

致命的なエラー: 14 行目の /home/rodingo/public_html/crawler/music.php の非オブジェクトに対するメンバー関数 find() の呼び出し

ただし、ローカルホストでは問題なく動作していますが、専用サーバーでは問題が発生しています。cURL、fopen すべてが有効になっていますが、まだ有効です。

 include('includes/simple_html_dom.php');

$html = file_get_html('http://mp3skull.com/mp3/'.$mp3name.'.html');
$list = array();
echo $html;
foreach ( $html->find('div#song_html ') as $e ) {  // <-- LINE 14
 $song = array();
    $song['bit'] = preg_replace('!\s+!', ' ',$e->find('div', 0)->plaintext);
    $song['title'] = preg_replace('!\s+!', ' ',$e->find('div', 1)->plaintext);
    $song['url'] = preg_replace('!\s+!', ' ',$e->find('a', 0)->href);
    $list[] = $song;
}
4

1 に答える 1

1

シンプルな HTML DOM を使用しているため、file_get_html代わりにfile_get_contents.

file_get_contents文字列をfile_get_html返しますが、HTML DOM オブジェクトを返します。

$html = file_get_html('http://mp3skull.com/mp3/'.$mp3name.'.html');
于 2013-02-08T23:01:18.383 に答える