PHP code example of serphouse / serphouse-php

1. Go to this page and download the library: Download serphouse/serphouse-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

serphouse / serphouse-php example snippets






use Serphouse\SERPHouseClient;

$serphouse = new SERPHouseClient('YOUR_API_KEY');

$serphouse->serpApi->live([
    'data' => [
        'q' => 'apple',
        'domain' => 'google.com',
        'lang' => 'en',
        'device' => 'desktop',
        'serp_type' => 'web',
        'loc' => 'Alba,Texas,United States',
        'loc_id' => '1026201',
        'verbatim' => '0',
        'gfilter' => '0',
        'page' => '1',
        'num_result' => '10',
    ],
]);

$serphouse->serpApi->live('DATA_ARRAY','responseType'); // default responseType is Json

$serphouse->serpApi->schedule([
    "data" => [
        [
            "q" => "Coffee",
            "domain" => "google.com",
            "lang" => "en",
            "device" => "desktop",
            "serp_type" => "web",
            "loc" => "Alba,Texas,United States",
            "verbatim" => 0,
            "postback_url" => "Webhook_url",
            "pingback_url" => "Webhook_url",
            "page" => 1,
            "num_result" => 10
        ]
    ]
]);

$serphouse->serpApi->check('SERP_ID');

$serphouse->serpApi->get('SERP_ID');

$serphouse->serpApi->get('SERP_ID','responseType'); // default responseType is Json

$serphouse->domains->list();

$serphouse->languages->list();

$serphouse->languages->list(['type'=> 'bing']); // default type is google

$serphouse->location->search(['q'=> 'texas']);

$serphouse->languages->search(['q'=> 'texas','type'=> 'bing']); // default type is google

$serphouse->account->fetch();

$serphouse->trends->search([
    'time_zone_offset' => '-330',
    'keywords' => 'google,youtube',
    'time' => 'now 1-d',
    'property' => 'youtube',
    'category' => '0',
    'geo' => 'us',
    'language_code' => 'en'
]);

$serphouse->trends->schedule([
    "data" => [
        [
            "time_zone_offset" => -330,
            "keywords" => "google",
            "time" => "now 1-d",
            "property" => "youtube",
            "category" => 0,
            "geo" => "us",
            "language_code" => "en",
            "postback_url" => "Webhook_url",
            "pingback_url" => "Webhook_url"
        ]
    ]
]);

$serphouse->trends->timeZoneList();

$serphouse->trends->categoryList();

$serphouse->trends->countryStateList();

$serphouse->trends->languageList();

$serphouse->trends->check('TRENDS_ID');

$serphouse->trends->get('TRENDS_ID');

    $response->getStatusCode()
    

    $response->getResponse()
    

    $response->getErrorMessage()
    
bash
composer