simple html dom - simple_html_dom.php parser not working -


I downloaded the simple_html_dom.php file and uploaded it to my web server and I immediately got it into a simple script Tested with, but it will not work, or at least I think it is not because it does not output anything.

Here's the script:

  & lt ;? Php required ('simple_html_dom.php'); // Retrieve the DOM from the given URL $ html = file_get_html ('http://davidwalsh.name/'); // Find all "A" tags and print their HREF foreign currency ($ HTML-> Search ('A') as $ E) {echo $ e-> Innertext '& lt; Br> & # 39; & # 39; }? & Gt;  

I got the script from this site and it was also presented on other sites, so I do not know why it will not do anything.

My guess is that the script is not able to recover any data from other websites, some problems like I came here.

If it was so, could there be any way to avoid the problem? / P>

Before I was added to the question of Bio Carlos, he said "this is not really a cross domain problem because you are not loading data from the server with the server", so there may be a way for example Load the data from the browser?

So, as the user868766 has suggested in my reply, I tried two ini_set methods that did not report any errors, so it seems that the script works just fine. . When I tried the print_r () method at $ html, it was output below:

  simple_html_dom object ([root] => simple_html_mode_onode object ([nodetype] = & gt; 5 [tag] = & gt; [ARR] => Array () [children] => array () [node] => array () [original] => [_] = & Gt; Array ([0] => - 1 [1] = & gt; 1) [DOM: Simple_HTML_dom_node: Private] = & gt; Simple_heart_dom Item * RECURSION *) [Nodes] => Array ( [0] = & gt; Simple_Html_Om_Onode Object ([Nedipteep] => 5 [tag] => root [atri] => array () [children] => array () [node] = & g T; array () [original] = & gt; [_] = & gt; array ([0] = & gt; -1 [1] = & gt; 1) [DOM: simple_ html_dom_node: private] => ; [Simple_heat_dom object * RECURSION *]) [callback] => [lowercase] => 1 [pos: protected] => [[cursor: protected] => 1 [guardian: protected] = & gt; ; Normal_ham_mamm_onode object ([nedipette] => 5 [tag] = 0 [four: protected] => [size: protected] => gt0; root [attr] = & gt; array () [ Children] = & gt; Array () [node] = & gt; Array () [original] = & gt; [_] = & Gt; Array ([0] => 1 [1] => 1) [DOM: simple_Html_ode: private] = & gt; Simple_html_dom object * RECURSION *) [token_blank: protected] => [Token_equal: protected] = & gt; = / & Gt; [Token_slash: protected] = & gt; / & Gt; [Token_attr: protected] = & gt; & Gt; [Self_cognising_tags: protected] = & gt; Array ([img] = & gt; 1 [br] => 1 [Input] => 1 [Meta] => 1 [Link] => 1 [hr] => 1 [Base] => 1 [embed] => 1 [spacer] => 1] [block_tags: protected] => 1 [] = & gt; 1 [div] = & gt; Array ([tr] => array ([tr] => 1 [td] => 1 [th] => 1) [th] => hey ([th] = & Array ([LE] = & gt; 1) [dt] = & gt; Hey ([1] [td] = & gt; Array ([TD] = & gt; 1] DT] = & gt; 1 [DD] = & gt 1] [DD] => Array ([DD] => 1 [DT] => 1] [DL] => Array ( [DD] = & gt; 1 [DT] => 1] [P] => array ([p] => 1) [nobr] => array ([nobr] => [1]) [doctor: protected] => [noise: protected] => array ()) 

The code you posted is working fine for me.

Think that you can try this, you can insert the rows given at the top of the script:

  ini_set ('error_reporting', E_ALL); Ini_set ('display_errors', 1);  

See also $ print_order of HTML

  print_r ($ html);  

Hope this help


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -