2016-04-15 29 views
0

我已經用我的項目打了另一個障礙,我正在使用simple_html_dom,並且似乎無法針對這兩點數據。我從https://survivetheark.com/index.php?/forums/topic/49912-vote-on-maps/定位幫助!嘗試使用simple_html_dom來抓取兩點數據

這裏是我放在一起的代碼,以獲得在右邊的數字,但似乎無法甚至能夠以此爲目標。

<?php 
include 'simple_html_dom.php'; 

$html = file_get_contents('https://survivetheark.com/index.php?/forums/topic/49912-vote-on-maps/'); 
$yourDesiredContent = $html->find('us.ipsList_reset.cPollList_choices li',8); 
echo $yourDesiredContent; 
?> 

The two points of data i am trying to collect

謝謝!

+0

試試這個..更新結束 –

回答

0
<?php 
include 'simple_html_dom.php'; 

$html = file_get_html('https://survivetheark.com/index.php?/forums/topic/49912-vote-on-maps/'); 

$cPollVoteBar = $html->find('ul.cPollList_choices',0)->find('li.ipsGrid',7)->find('div.ipsGrid_span7',0)->find('span.cPollVoteBar',0)->find('span',0); 

$yourDesiredContent = $cPollVoteBar->data-votes; 

?> 

這將解決您的問題,如果不讓我知道錯誤,因爲我沒有檢查過它。

+0

感謝您的回覆,我雖然收到此錯誤: [15-APR-2016 14點59分54秒UTC] PHP致命錯誤:調用一個成員函數find()方法上第5行中的/home/travisohdell1/public_html/JL_TwitchStatus/votecount/votecounter.php中的非對象 –