rani/searchengine

一个用于抓取搜索引擎结果和提取一组关键词元数据的库

v1.0 2022-07-04 18:25 UTC

This package is auto-updated.

Last update: 2024-09-04 23:50:22 UTC


README

一个用于抓取搜索引擎(google.com 和 google.ae)的前5页结果和提取一组关键词元数据的库。

需求

  • PHP 7.2 或更高版本

安装

您可以通过 Composer 安装此库。如果您还没有安装 Composer,请按照以下说明安装,具体取决于您选择的操作系统:

安装 Composer 后,运行以下命令安装库:

composer require rani/searchengine

使用方法

创建一个新的 PHP 文件,并将以下代码粘贴到其中

<?php 

namespace Rani\Searchengine;
require_once './vendor/autoload.php';

$client = new SearchEngine();

//set search engine (google.com or google.ae)
$searchengine = $client->setEngine("google.com");

//search keywords goes here
if($searchengine){
    $results = $client->searchdata(["keyword1","keyword2"]);

    //print the results
    print_r($results);
}
?>

使用以下命令运行您的 PHP 文件,或者在浏览器中运行该文件。

php {filename}.php

许可证

MIT