Goutte PHP 爬虫库

程序名称:Goutte

授权协议: MIT

操作系统: 跨平台

开发语言: PHP

Goutte 介绍

Goutte 是一个抓取网站数据的 PHP 库。它提供了一个优雅的 API,这使得从远程页面上选择特定元素变得简单。

示例代码

require_once '/path/to/goutte.phar';

use Goutte\Client;

//发送请求
$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'));

//提取数据
$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());

Goutte 官网

https://github.com/fabpot/Goutte

相关编程语言

Pacman 是一个软件包管理器, 作为 ArchLinux 发行版...
Smb4K 是KDE下的网络共享浏览器 更多屏幕截图请看:...
Wine (“Wine Is Not an Emulator” 的首字母缩写)...
虚拟桌面软件,可管理最多9个虚拟桌面,你可以用热键...
UNetbootin (Universal Netboot Installer)为一种跨...
Cobbler 可以用来快速建立 Linux 网络安装环境,它已...