Stuck with Simple Html Dom and retrieved information

I am trying to use a simple html DOM to extract everything inside a tag with the "sitepoint" class. Here is my code that doesn't work:

<?php
include_once('simple_html_dom.php');

$html = file_get_html('examplewebsite');
$ret = $html->find('.sitepoint');
echo $ret;

?>

      

Below is an example of one of the sitepoint tags (there are ten or so) with the information I want.

<dl class="sitepoint">
<dd class="thumbnail">
<a href="blabla" ></a><a href="/toolbar/sidepanel.php?url=random.html" >Get This      Now</a>   </dd><dt class="notext"><a href="/to/" >Title</a></dt><dd class="starts">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td class="textUncolor"> CUT OUT SOME IMAGES AND       ADDRESSES HERE
                            </td></tr>
</table>
</dd>

      

Can anyone help me get it to work?

+2


source to share


1 answer


You need to access the externaltext attribute.

 $html->find('.sitepoint',0)->outertext;

      

Check out the docs for more information . Look under "magic attributes"



EDIT

When choosing classes, you need to indicate which one is used in the document. I've modified the example above to reflect this. This has been tested and works. (note 0 as the second parameter)

0


source







All Articles