alirmaity / phpsecrawler
用于搜索引擎的php爬虫
1.3
2022-10-07 23:38 UTC
Requires
README
PHP-SE-CRAWLER
PHP-SE-CRAWLER是用于搜索引擎(如google,bing)的php爬虫工具,它为您提供获取标题、描述、链接和排名的输出能力。
安装
使用composer安装最新版本,或者更倾向于克隆仓库或下载最新版本。
$ composer install
$ composer require ali.rmaity/php-se-crawler -- not stable
此包可在[packagist]上找到,并建议使用composer加载。我们支持php 7.2,7.3和7.4。
基本用法
// Assuming you installed from github repo require_once '../load-env.php'; require_once '../src/astroMethods.php'; use src\astroMethods; $client = new astroMethods(); $client->setEngine("google.ae"); try { $results = $client->search(["ferrari","cars"]); $results = new ArrayIterator($results); $results->asort(); foreach ($results as $result) { echo implode(',',$result) . '<br><br>'; } } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }