Fetch the repository succeeded.
PHP simple http client/spider class/简单的 PHP 的网络库
特色:
composer require zv/spider
$spider = new \ZV\Spider('https://www.baidu.com/s?wd=爱情&pn=50&rn=50&tn=json', [
//'User-Agent' => 'mobile',
]);
$spider->GET();
print_r($spider->getResponseCode());
print_r($spider->getResponseHeader());
print_r($spider->getBody());
print_r($spider->getUrl());
print_r($spider->getJson());
use \ZV\Spider as spider;
$spider = new spider('http://127.0.0.1/post', [
]);
$spider->POST([
'query' => 1,
// upload
'file1' => '@' . __FILE__,
// upload file with MIME
'file2' => '@' . __FILE__ . ';text/plain'
]);
print_r($spider->getBody());
use \ZV\Spider as spider;
// html2txt (has newline)
echo spider::html2txt('<h1>html2txt</h1>'), PHP_EOL,
// no html(without newline)
spider::noHtml('<h1>noHtml</h1>'), PHP_EOL,
// strip_tags
spider::strip_tags('<h1>strip_tags</h1>'), PHP_EOL,
// cut str
spider::cut('<h1>cut</h1>', '<h1>', '</h1>'), PHP_EOL,
// match with mask
spider::maskMatch('<h1>maskMatch</h1>', '<h1>(*)</h1>'), PHP_EOL,
// match with regexp
spider::regMatch('<h1>regMatch</h1>', '#<h1>([^>]*?)</h1>#is'), PHP_EOL,
// match with multi pattern
print_r(spider::match('<h1>MatchByMultiPattern</h1><h2>Description</h2>', [
'title' => '#<h1>([^>]*?)</h1>#is',
'desc' => '<h2>(*)</h2>'
]), 1), PHP_EOL;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.