0
我試圖讓網頁的標題,見下面的代碼..HTML DOM犯規得到的結果,而他們在那裏
include("simple_html_dom.php");
$url = "http://fzmoviez.in/video/list/4059539";
$base = $url;
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_URL, $base);
curl_setopt($curl, CURLOPT_REFERER, $base);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$str = curl_exec($curl);
curl_close($curl);
// Create a DOM object
$html_base = new simple_html_dom();
// Load HTML from a string
$html_base->load($str);
$title = $html_base->getElementsByTagName("title")->innertext; //line 21
echo $title;
我得到錯誤:
Notice: Trying to get property of non-object in C:\xampp\htdocs\... on line 21
但是當我var_dump($html_base)
我得到
object(simple_html_dom)#1 (23) { ["root"]=> object(simple...
... card" ["attr"]=> array(2) { ["id"]=> string(5) "index" ["title"]=> string(179) "FzMoviez.iN - Free Download Latest Bollywood Movies,Hindi Dudded Movies,Hollywood Movies,Live Movies,WWE Shows,Mp4,HD Mp4,High Quality Mp4,Avi,Iphone,Android,Tablets And Many More" } ["children"]=> array(25) { [0]=> object(simple_html_dom_node)#55 (9) { ["nodetype"]=>......
意義,它是一個對象,和標題是有,爲什麼給錯誤
Notice: Trying to get property of non-object in C:\xampp\htdocs\.. on line 21
很難說因爲您已經刪除了大部分轉儲,但它看起來像'title'是_attribute_而不是標籤名稱。 –