php - Why is item returning as non-object when using DOMDocument? -
php - Why is item returning as non-object when using DOMDocument? -
i writing script deed ajax phone call , validate given url. error trying property of non-object
on line calls $node->item(0)
have ideas?
function validateurl(){ $curl = curl_init(); curl_setopt($curl, curlopt_url, 'http://basecmd.com'); $result = curl_exec($curl); if(!curl_exec($curl)){ header('content-type: text/xml'); $this->output->set_output( '<error> <message>'.curl_error($curl).'</message> </error>'); } else { $doc = new domdocument(); @$doc->loadhtml($result); $nodes = $doc->getelementsbytagname('title'); //get , display need: $title = $nodes->item(0)->nodevalue; header('content-type: text/xml'); $this->output->set_output( '<success> <message>successfully added '.$title.' list of references.</messages> <title>'.$title.'</title> </success>'); } curl_close($curl); }
php dom curl
Comments
Post a Comment