hardworm/webmaster.api

Yandex Webmaster Api v4.1 库

1.4.0 2021-09-07 08:59 UTC

This package is auto-updated.

Last update: 2024-09-16 19:38:57 UTC


README

安装

Composer

添加到 composer.json 中

{
    "require": {
        ...
        "hardworm/webmaster.api": "1.4.*"
        ...
    }
}

或者

php composer.phar require hardworm/webmaster.api "dev-master"

在将包放在 Packagist.org 之前需要

    ...
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/hardworm/webmaster.api"
        }
    ]
    ...

手册

克隆仓库并要求 webmasterApi.php

用法

如何使用示例

  1. 在使用此代码之前,请访问 https://oauth.yandex.ru/client/new 并添加新客户端

  2. 创建文件 "example/config.php",通过复制 "config.example.php"。在此处添加客户端 ID 和密钥代码以使用示例

如何使用 webmasterApi 类

  1. https://oauth.yandex.ru/client/new 页面上添加客户端。不要忘记设置正确的返回 URL

  2. 对于测试,您可以通过方法 webmasterApi::getAccessToken 获取临时访问令牌(阅读方法的注释)

  3. 如果您想要获取正确的访问令牌,您必须创建授权代码。

    1. 阅读文档 https://tech.yandex.ru/oauth/doc/dg/reference/web-client-docpage/
    2. 将您的客户端定位到 https://oauth.yandex.ru/authorize?response_type=code&client_id=[yourclient_id]
    3. 使用静态方法 getAccessToken 获取访问令牌
    4. 使用静态方法 webmasterApi::initApi 创建 webmasterApi 对象

您可以在 example/.auth.php 中查看如何工作

  1. 享受吧!

方法

  • addHost
  • addOriginalText
  • addQueueRecrawl
  • addSitemap
  • checkVerification
  • curlOpts
  • dataToString
  • delete
  • deleteHost
  • deleteOriginalText
  • deleteSitemap
  • errorCritical
  • get
  • getAccessToken
  • getApiUrl
  • getDiagnostics
  • getHostInfo
  • getHostOwners
  • getHostSitemaps
  • getHostSummary
  • getHostUserSitemaps
  • getHosts
  • getIndexingHistory
  • getIndexingSamples
  • getOriginalTexts
  • getPopularQueries
  • getQueueRecrawl
  • getQuotaRecrawl
  • getSearchUrlHistory
  • getSearchUrlSamples
  • getSearchUrlEventHistory
  • getSearchUrlEventHistorySamples
  • getSqiHistory
  • getStateRecrawlQueue
  • getUserID
  • initApi
  • post
  • verifyHost