I want to fetch the content of the heading tag given below:
<h1 style="BACKGROUND-COLOR: white; line-height: 2em; margin:0 .5em .2em .5em; padding: 4px 8px 4px 8px; border-radius: 10px;-moz-border-radius: 10px; -webkit-border-radius: 10px; border: 1px solid silver;text-decoration:none; font-size: 2.1em;">Seminar Report</h1><div style='position:relative; visibility:visible; width:100%; overflow:auto;' align='center'>
Can I do it using file_get_html()
or file_get_contents()
?
This is what i am getting when I use var_dump($html);
object(simple_html_dom)#1 (23) { ["root"]=> object(simple_html_dom_node)#2 (9) { ["nodetype"]=> int(5) ["tag"]=> string(4) "root" ["attr"]=> array(0) { } ["children"]=> array(2) { [0]=> object(simple_html_dom_node)#3 (9) { ["nodetype"]=> int(2) ["tag"]=> string(7) "comment" ["attr"]=> array(0) { } ["children"]=> array(0) { } ["nodes"]=> array(0) { } ["parent"]=> RECURSION ["_"]=> array(2)
and so on
and when I use var_dump($html->find('h1'));I get
array(1) { [0]=> object(simple_html_dom_node)#48 (9) { ["nodetype"]=> int(1) ["tag"]=> string(2) "h1" ["attr"]=> array(1) { ["style"]=> string(233) "BACKGROUND-COLOR: white; line-height: 2em; margin:0 .5em .2em .5em; padding: 4px 8px 4px 8px; border-radius: 10px;-moz-border-radius: 10px; -webkit-border-radius: 10px; border: 1px solid silver;text-decoration:none; font-size: 2.1em;" } ["children"]=> array(0) { } ["nodes"]=> array(1) { [0]=> object(simple_html_dom_node)#49 (9) { ["nodetype"]=> int(3) ["tag"]=> string(4) "text" ["attr"]=> array(0) { } ["children"]=> array(0) { } ["nodes"]=> array(0) { } ["parent"]=> *RECURSION* ["_"]=> array(1) { [4]=> string(14) "Seminar Report" } ["tag_start"]=> int(0) ["dom":"simple_html_dom_node":private]=> object(simple_html_dom)#1 (23) { ["root"]=> object(simple_html_dom_node)#2 (9) { ["nodetype"]=> int(5) ["tag"]=> string(4) "root" ["attr"]=> array(0) { } ["children"]=> array(2) { [0]=> object(simple_html_dom_node)#3 (9) { ["nodetype"]=> int(2) ["tag"]=> string(7) "comment" ["attr"]=> array(0) { } ["children"]=> array(0) { } ["nodes"]=> array(0) { } ["parent"]=> *RECURSION* ["_"]=> array(2) { [0]=> int(1) [4]=> string(23) "" }