I am trying to get title of the webpage, see the code below..
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;
I am getting error:
Notice: Trying to get property of non-object in C:\xampp\htdocs\... on line 21
but when I var_dump($html_base)
I get
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"]=>......
meaning, it is an object, and title is there, why giving error
Notice: Trying to get property of non-object in C:\xampp\htdocs\.. on line 21