i can access of 'class' items a
$ret = $html->find('articleinfo'); , print first key of returned array.
however, there other tags need span=id"firstarticle_0" , cannot seem find it.
$ret = $html->find('#span=id[ etc ]');
in cases returned, it's not array, or array empty keys.
unfortunately cannot use var_dump see object, since var_dump produces 1000 pages of unreadable junk. code looks this.
<div id="articlething"> <p class="byline">by lord byron , <a href="www.marriedtothesea.com">alister crowley</a></p> <p> <span class="location">georgia mountains, canada</span> | <span class="timestamp">fri apr 29, 2011 11:27am edt</span> </p> </div> <span id="midpart_0"></span><span class="mainparagraph"><p><span class="midlocation">tuscaloosa, alabama</span> - invented cheese? wants know. held big meeting. tom cruise scientologist. </p> </span><span id="midpart_1"></span><p>the president , family visited chuck-e-cheese in morning </p><span id="midpart_2"></span><p>in russia, 900 people lost in balls.</p><span id="midpart_3">
simple html dom can used find span specific class.
if want span's class=location then:
// create html dom $html = file_get_html($iurl); // text elements $aobj = $html->find('span[class=location]');
then like:
foreach($aobj $key=>$ovalue) { echo $key.": ".$ovalue->plaintext."<br />"; }
it worked me using example output was:
label=span, class=location: found 1
0: georgia mountains, canada
hope helps... , please simple html dom great , easy use once hang of it. keep trying , have number of examples use on , on again. i've scraped pretty crazy pages , easier , easier.
Comments
Post a Comment