数据抓取器将结果保存到数据库中


Data scraper save the results to database

我想制作一个Scraper或spider,它可以从代码中抓取数据并将数据插入数据库:

<tr>
              <td class="player-player-name">
              <a href="/poker-players/14147-david-peat">David Peat</a>
              </td>
            <td><img alt="UNITED STATES" class="flag" src="/packages/flags/us-238691e8450c6bd68131f09bcf546d4a.png" title="UNITED STATES" /> Las Vegas, NV, USA</td>
            <td>$277,047</td>
              <td class="recent-cashes">
                <a href="/poker-tournaments/876-2007-mirage-poker-showdown-wpt/7540" class="event-name-link" ref="nofollow">No-Limit Hold&#x27;em Championship Event 10</a>
              </td>
            </tr>

我还需要保存标志和链接到下一页。大约有20页的扑克玩家,我需要保存在我的数据库中2016年的扑克玩家和统计数据。

链接到页面:http://www.cardplayer.com/poker-players

类似的东西。。。。。

      <?php
include('simple_html_dom.php');
$html = file_get_html('http://www.cardplayer.com/poker-players');
$theData = array();
foreach($html->find('.table-lined tr') as $row) {

$rowData = array();
foreach($row->find('td') as $cell) {

    $rowData[] = $cell->innertext;
}

$theData[] = $rowData;
}
$length = count($theData);
for ($i = 1; $i < $length; $i++) {

         echo "Player Name".$theData[$i][0]."----location".$theData[$i][1]."casino--".$theData[$i][2]."most".$theData[$i][3]."<br/>";
 }
?>