I’ve tried this a few different ways and nothing seems to work. (I tried all examples at How to imitate child selector with Simple HTML DOM?) Used code as is, changing what I needed for my needs, ie class=xxx and the url.
So I’m trying pull out some information from a web page. There are no children to work with as far as DOM is concerned and using the xpath method got me nothing returned. I’m guessing I’m doing something wrong.
<div id="wpp-6" class="widget popular-posts">
<div class="widget_title">POPULAR</div><!-- WordPress Popular Posts Plugin v2.3.2 [Widget] [daily] [regular] -->
<ul>
<li>
<a href="http://link.html" title="Title of post" class="wpp-post-title">THE DATA I WANT</a> <span class="post-stats"></span>
</li>
<!-- More lists -->
</ul>
</div>
There are about 9 more list statements after that.
Any suggestions?
Useing PHP Simple HTML DOM Parser you can do it easily, Just download the
simple_html_dom.phpfile from here and use it as follows.Output will be (Tested on Monday January 14, 2013)
If you want to print the title with
linklike<a>...</a>then just useecho $a