jjacquay712 Posted April 5, 2009 Share Posted April 5, 2009 I am trying to extract the data in the title tag using php's DOM parser. Any idea how to do this? This is what i have so far: <?php $html = "<html><head><title>Test Page</title></head><body><p>Test</p></body></html>"; $page = new DOMDocument; $page->loadHTML($html); $head = $page->getElementsByTagName('head'); $title = $head->item(0)->getElementsByTagName('title'); print_r($title) ?> Link to comment https://forums.phpfreaks.com/topic/152615-solved-parsing-html-title-tag-with-dom/ Share on other sites More sharing options...
jjacquay712 Posted April 5, 2009 Author Share Posted April 5, 2009 No need to reply so quickly guys! It's ok, I figured out how to do it anyway. Link to comment https://forums.phpfreaks.com/topic/152615-solved-parsing-html-title-tag-with-dom/#findComment-801534 Share on other sites More sharing options...
techcone Posted April 5, 2009 Share Posted April 5, 2009 Use Simple HTML Dom Parser. Link to comment https://forums.phpfreaks.com/topic/152615-solved-parsing-html-title-tag-with-dom/#findComment-801623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.