nticaric/majestic-seo-api

PHP 库,用于向 Majestic SEO API 发送请求

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

This package is auto-updated.

Last update: 2024-09-20 01:46:57 UTC


README

Total Downloads

majestic-seo-api

PHP 库,用于向 Majestic SEO API 发送请求

##安装

安装 Majestic SEO API 最简单的方法是使用 composer。创建以下 composer.json 文件,然后运行 php composer.phar install 命令来安装。

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

##示例

GetBackLinkData

此函数返回域名、子域名或 URL 层级的反向链接信息。

用法

    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());

另一种实现方式是

    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());

executeCommand 方法允许您使用相应的参数执行任何可用的方法。要查看可用的命令,请参阅 文档