Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to parse webpage using php
    primarykey
    data
    text
    <p>I am trying to parse a webpage and print out a table which is on the webpage. I am using php_simple_html dom parser. However, when I try to parse the table off the webpage, all the javascript commands to output the table get turned into comments within the php:</p> <pre><code>&lt;html&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;?php include 'crawling/simple_html_dom.php'; $html = file_get_html('http://uiucfreefood.com/'); $ret = $html-&gt;find('body', 0)-&gt;find('div', 10)-&gt;find('table',0); //gets to the table tag echo $ret; // nothing is echoed out because the original webpage uses jscript commands to write the table to the page but these commands get turned to comments for some reason. ?&gt; &lt;/html&gt; </code></pre> <p>When I inspect the element of the page where I am echoing the parsed information I am able to see that the table tag with all the info is in there but the jscript commands have been turned into comments. Is there a way for me to just grab the info and echo it out myself? I tried adding another ->find('tbody'); at the end of the parse command but it doesn't do anything. Any advice is appreciated. Thanks.</p> <p>EDIT: You can try this code out yourself if you download the simple_html_dom.php and include it in your php file. Source: <a href="http://sourceforge.net/projects/simplehtmldom/files/" rel="nofollow">http://sourceforge.net/projects/simplehtmldom/files/</a></p> <p>EDIT: Just noticed something really important. The javascript commands are commented out in the original webpage also. Instead, the original webpage is using a javascript function to print out the table which I do not have defined. Writing that function myself should fix the issue. </p> <p>EDIT: yup, that worked. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload