An open API service indexing awesome lists of open source software.

https://github.com/webbamboo/seoresearch-serp-sdk

Google SERP results in PHP via Seoresearch API
https://github.com/webbamboo/seoresearch-serp-sdk

Last synced: about 1 year ago
JSON representation

Google SERP results in PHP via Seoresearch API

Awesome Lists containing this project

README

          

# Google SERP Results in PHP
SEOResearch SERP API enables you to scrape Google search results straight from your code. It requires a [free registration](https://seoresearch.net/google-search-api/) at Seoresearch.net
# Quick start
For composer ([Packagist](https://packagist.org/packages/webbamboo/seoresearch-serp-sdk)).
```bash
composer require webbamboo/seoresearch-serp-sdk
```
Load the dependency in your script:
```php
getHistory());
```
## Create SERP request
```php
keyword = 'serp api google';
$serp->endpoint = 'http://your-webhook-url.com/webhook.php';

$serp->sendToApi($sdk);
var_dump($serp);
```
## Get SERP results
```php
fromId($sdk, 'YOUR_SERP_ID');

var_dump($serp);
```
## Webhook
```php
webhook($_POST, true));
```
## Anatomy of a SERP object
In order to populate a Serp object you can set the following properties: location, endpoint, mobile, keyword. You can see more about how that works in the [Create SERP request](#Create_SERP_request_49) section.
Methods:
- fromId(Sdk $sdk, $id) - Queries the API and hydrates the Serp object with the data. Takes an SDK object and Serp ID as a parameter.
- fromData($apiData) - Hydrates a Serp object from API response string
- sendToApi(Sdk $sdk) - Creates the actual Serp object in the API and updates the Serp object with the ID of the created resource