How to get title from a website by xpath?

Posted by qxxx on Stack Overflow See other posts from Stack Overflow or by qxxx
Published on 2012-07-01T08:54:37Z Indexed on 2012/07/01 9:15 UTC
Read the original article Hit count: 157

Filed under:
|
|
|

I am playing around with xpath, but have no Idea how to for example get a title from a website using xpath, here is my code but I don't know what to do next...

$dom = new DOMDocument();
$dom->loadHTMLFile("http://www.cool.de");

$x=new DOMXPath($dom);
$result = $x->query("//TITLE");

//...???

and print_r($result) shows me only "Object", is there a function like print_r to see what is inside an object so I don't have to guess?

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml