<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          GouttePHP 爬蟲庫

          聯(lián)合創(chuàng)作 · 2023-09-21 23:32

          Goutte 是一個抓取網站數(shù)據的 PHP 庫。它提供了一個優(yōu)雅的 API,這使得從遠程頁面上選擇特定元素變得簡單。

          示例代碼:

          require_once '/path/to/goutte.phar';
          
          use Goutte\Client;
          
          //發(fā)送請求
          $client = new Client();
          $crawler = $client->request('GET', 'http://www.oschina.net/');
          
          //點擊鏈接
          $link = $crawler->selectLink('Plugins')->link();
          $crawler = $client->click($link);
          
          //提交表單
          $form = $crawler->selectButton('sign in')->form();
          $crawler = $client->submit($form, array('signin[username]' => 'fabien', 'signin[password]' => 'xxxxxx'));
          
          //提取數(shù)據
          $nodes = $crawler->filter('.error_list');
          if ($nodes->count())
          {
            die(sprintf("Authentication error: %s\n", $nodes->text()));
          }
          
          printf("Nb tasks: %d\n", $crawler->filter('#nb_tasks')->text());
          瀏覽 15
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  三级久久网 | 国产三级网站免费观看 | 久久视频黄 | 青青草成人自拍 | 美女扒开超粉嫩的尿囗让人桶91 |