0

テーブルからチーム名をスクレイピングするためのこのコードがあります

$url = 'http://fantasy.premierleague.com/my-leagues/303/standings/';
$html = @file_get_html($url);
//Cut out the table
$FullTable = $html->find('table[class=ismStandingsTable]',0);
//get the text from the 3rd cell in the row 
$teamname = $FullTable->find('td',2)->innertext;
echo $teamname;

これはうまくいきます..そして、この出力が得られます....

<a href="/entry/110291/event-history/33/">Why Always Me?</a>

しかし、これらの行を追加すると..

$teamdetails = $teamname->find('a')->href;
echo $teamdetails;

完全に空白の出力が得られます。

理由はありますか?/entry/110291/event-history/33/を1 つの変数として、を別の変数として取得しようとしてWhy Always Me?います。

4

4 に答える 4