我可以使用
$ret = $html->find('articleINfo'); and then print the first key of the returned array.
但是,我还需要其他标签,例如 span=id"firstArticle_0" ,但我似乎找不到它。
$ret = $html->find('#span=id[ etc ]');
在某些情况下会返回一些东西,但它不是一个数组,或者是一个带有空键的数组。
不幸的是,我不能使用 var_dump 来查看对象,因为 var_dump 会产生 1000 页不可读的垃圾。代码看起来像这样。
<div id="articlething">
<p class="byline">By Lord Byron and <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> - Who invented cheese? Everyone wants to know. They held a big meeting. Tom Cruise is a scientologist. </p>
</span><span id="midPart_1"></span><p>The president and his family visited Chuck-e-cheese in the morning </p><span id="midPart_2"></span><p>In Russia, 900 people were lost in the balls.</p><span id="midPart_3">