nticaric/majestic-seo-api

PHP library for making requests to the Majestic SEO API

v1.0.0 2015-03-27 22:47 UTC

This package is auto-updated.

Last update: 2024-03-20 00:37:52 UTC


README

Total Downloads

majestic-seo-api

PHP library for making requests to the Majestic SEO API

##Instalation

The easiest way to install Majestic SEO API is via composer. Create the following composer.json file and run the php composer.phar install command to install it.

{
    "require": {
        "nticaric/majestic-seo-api": "1.0.*"
    }
}

##Examples

GetBackLinkData

This function returns information of the backlinks at domain, subdomain or URL level.

Usage:

    use Nticaric\Majestic\MajesticAPIService;

    //if the second parameter is set to true, the sanbox mode is used
    $service = new MajesticAPIService("your_api_key", true);
    $params = array(
        'MaxSameSourceURLs' => 1
    );

    $response = $service->getBackLinkData('example.com', $params);

    print_r( (string) $response->getBody());

Another way to do the same is:

    use Nticaric\Majestic\MajesticAPIService;

    //if the second parameter is set to true, the sanbox mode is used
    $service = new MajesticAPIService("your_api_key", true);
    $params = array(
        'item' => 'example.com',
        'MaxSameSourceURLs' => 1
    );

    $response = $service->executeCommand('GetBackLinkData', $params);

    print_r( (string) $response->getBody());

The executeCommand method lets you execute any method available with according parameters. To see what commands are available take a look at the documentation