私はPHP Simple HTML Dom Parserを使ってウェブサイトからいくつかの情報を取得しようとしています。ウェブサイトには、 "forumborder2"クラスのテーブルがたくさんあり、その中にいくつかの情報を得たいと思っています。次の例では、イメージソースが必要です。PHP - シンプルなHTML Dom Parser
foreach($html->find('table[class="forumborder2"]')as $tr){
echo $tr->children(1)->children(1)->src; }
は、これは常にエラーを与える:「非オブジェクトのプロパティを取得しようとすると、」
<table class="forumborder2" width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr>
<td class="titleoverallheader2" background="modules/Forums/templates/chunkstyle/imagesnew/forumtop.jpg" style="border-top:0px; border-left:0px; border-right:0px;" width="100%" colspan=7 Align=left>
<b>Supernatural </b>(2005) - Enviada por: <b>AlJoSi</b> em 6 de Dezembro, 2011 (22:35:11)
</td>
</tr>
<tr height=25>
<td class="colour12" align=right width=100>
<b>Idioma:</b>
</td>
<td width=110 class="colour22">
<img src="modules/Requests/images/fPortugal.png" width=18 height=12 border=0 alt='' title=''>
</td>
</tr> </table>
は、私は次のようでした。もし私が
$tr->children(1)->children(1)
に行くのであれば、
<img src="modules/Requests/images/fPortugal.png" width=18 height=12 border=0 alt='' title=''>
を得ることができます。なぜsrc属性にアクセスできないのですか?
を役に立てば幸い?そして**何のエラー**? – Jon
@Jon、[PHP Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/)。エラーのある投稿も変更しました。 – Barata