Package to communicate with Majestic.com Live and Sandbox URLs.

dev-master 2019-03-19 13:25 UTC

This package is auto-updated.

Last update: 2024-11-20 06:35:58 UTC


README

A package to allow communication with Majestic.com API, through production or sandbox environments.

Prerequisits

Installation

Via composer

composer require lunardevelopment/majestic

Via ZIP

Download this ZIP and manually include

require_once 'theUnzippedDirectory/src/Majestic.php'

Usage

See in depth commands and parameters at Majestic.com API Commands

GetIndexItemInfo

    use LunarDevelopment\Majestic; 

    $majestic_api_key = "YOUR_API_KEY";
    $domain = "example.com";
    
    $service = new Majestic($majestic_api_key, false);
    
    $params = array(  
        'datasource'=>'fresh', 
        'item0' => $domain , 
        'items' => 1
    );
    
    $response = $service->executeCommand('GetIndexItemInfo', $params);
    
    $majestic_json_data = json_encode(json_decode($response->getBody())->DataTables->Results->Data[0]);

    dd($majestic_json_data); 

GetBackLinkData

    use LunarDevelopment\Majestic; 

    $majestic_api_key = "YOUR_API_KEY";
    $domain = "example.com";

    $service = new Majestic($majestic_api_key, false);

    $params = array(
        'item' => $domain,
        'datasource' => 'fresh',
        'Count' => 1000,
        'Mode' => 1,
        'ShowDomainInfo' => 1,
        'MaxSourceURLsPerRefDomain' => 1,
        'MaxSameSourceURLs' => 1,
        'FilterTopicsRefDomainsMode' => 1
    );

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

    $backlinks = json_decode($response->getBody())->DataTables->BackLinks->Data;

    dd($backlinks);