I have got this function :
function getTitle(){
$crawler = new DOM_Crawler($this->url);
try{
if ( $title = $crawler->getPage()->getPageTitle()) {
$this->debug_element("title", $title);
unset($crawler);
return $title;
} else {
unset($crawler);
return self::TITLE_FETCH_WARN;
}
}
catch(Exception $e){
return self::TITLE_FETCH_WARN;
}
}
I am trying to prevent crawler..be a non object and prevent that error from being thrown.. try and catch ..so how can I catch the exception ?
Fatal error: Call to a member function getPageTitle() on a non-object in C:\Program Files (x86)\Zend\Apache2\htdocs\backlinks\cron\Backlinks.php on line 163