PHP Simple HTML Dom Question.

Feb 7, 2010
148
1
0
I just need to grab the page title; whatever is between <title>and</title> and echo it back out.

I'm fine with pulling the data, its just this parsing example that I need.

I cant seem to get the syntax right. I have no experience with DOM or SHD, can someone give me a hint?
 


you can use xpath, but...
Code:
if(preg_match('/<title>(.*?)<\/title>/',$page,$match)) {
  echo $match[1];
}else {
  echo 'title could not be scraped';
}
... is the quick 'n durrty way.
 
Ah, I thought Simple Dom would have some magic method for me. Kind of calls into question my whole reason for using it.

Thanks for the help.