PHP code example of proapis / proapis-client

1. Go to this page and download the library: Download proapis/proapis-client 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/ */

    

proapis / proapis-client example snippets




use Proapis\Services\GoogleSerps;

// Set your API key
$apiKey = "######################";

// Create instance
$gs = new GoogleSerps($ApiKey);

// Get data
$params = [
    "q" => "Your search query",
    "pages" => 10,
    "hl" => "en_US",
    "gl" => "us",
    "ua" => "desktop"
];
$data = $gs->getData($params);

use Proapis\Services\GooglePlay;

// Set your API key
$apiKey = "######################";

// Create instance
$gp = new GooglePlay($ApiKey);

// Get data
$params = [
    "package" => "com.whatsapp"
];
$data = $gp->getData($params);

use Proapis\Services\Keywords;

// Set your API key
$apiKey = "######################";

// Create instance
$kp = new Keywords($ApiKey);

// Get data
$params = [
    "keyword" => "hiking shoes"
];
$data = $kp->getData($params);

use Proapis\Services\Moz;

// Set your API key
$apiKey = "######################";

// Create instance
$moz = new Moz($ApiKey);

// Get data
$data = [
    "domains" => ["google.com", "facebook.com", "wikipedia.org"]
];
$data = $moz->getData($data);

use Proapis\Services\GoogleSerps;
use Proapis\Exceptions\ApikeyException;
use Proapis\Exceptions\CreditsException;
use Proapis\Exceptions\InvalidkeyException;
use Proapis\Exceptions\ServerException;
use Proapis\Exceptions\ValidationException;

// Set your API key
$apiKey = "######################";

// Create instance
$gs = new GoogleSerps($ApiKey);

// Get data
$params = [
    "q" => "Your search query",
    "pages" => 10,
    "hl" => "en_US",
    "gl" => "us",
    "ua" => "desktop"
];

try
{
    $data = $gs->getData($params);
    print_r($data);
} catch(ApikeyException $e) 
{
    // API key not provided
} catch(CreditsException $e)
{
    // Credits exhausted. Buy more at https://proapis.cloud
} catch(InvalidkeyException $e)
{
    // API key is invalid
} catch(ServerException $e)
{
    // Our servers are down. Maybe for maintenance
} catch(ValidationException $e)
{
    // Validation errors occured
    print_r($e->getMessage());
}