impact-seo/killduplicate-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

impact-seo/killduplicate-api-php

Composer 安装命令:

composer require impact-seo/killduplicate-api-php

包简介

PHP Example Library to use KillDuplicate API

README 文档

README

PHP Example Library to use KillDuplicate API

Install this library

composer require impact-seo/killduplicate-api-php=dev-master

or download and uncompress archive

Set config.php

API Specifications

Get your remaining credits

GET /api/public/credits/api_key

Params

api_key = Your Private API Key # required

Returns

credits

Get scan cost (before running it for instance)

POST /api/public/price

Params

api_key = Your Private API Key # required
text = Your Text (UTF-8 encoded) # required

Scan Text

POST /api/public/scan

Params

api_key = Your Private API Key # required
text = Your Text (UTF-8 encoded) # required
exclude_domains = Array of excluded domain names from duplicate search # optional
callback = Your callback url # required
format = desired return format # optional - possible values : json|xml - default : json 

Returns Immediate response

text_id : store this id for retrieving result in callback
credits : how much credits this scan has cost

Callback Response

{
    "id": "82",
    "resume": "Demain, d\u00e8s l'aube, \u00e0 l'heure o\u00f9 blanchit la ca",
    "filename": null,
    "credits": "1",
    "date": "2016-04-01 16:41:43",
    "callback": "http:\/\/www.your-website.com\/vendor\/impact-seo\/killduplicate-api-php\/api_callback.php",
    "format": "json",
    "result": "long",
    "duplicate": "0",
    "dup_percentage": "0",
    "text": null,
    "exclude_domains": {},
    "search_dupes": {
        "1692": {
            "id": "1692",
            "text_id": "82",
            "phrase": "Demain, d\u00e8s l'aube, \u00e0 l'heure o\u00f9 blanchit la",
            "search_dupe_results": []
        },
        ...
    },
    "search_dupe_results": [],
    "phrases_to_check": "11",
    "phrases_checked": 11,
    "results": []
}

Get Scan

If for some reason, previous callback function is not send from our servers or not received by yours, you can force a call to retrieve specific scan status. To know if a scan has finished, you have to compare phrases_to_check against phrases_checked parameters. We stongly advise you to set up a callback function and use this call only to retrieve lost results.

GET /api/public/scan/API_KEY/SCAN_ID

Params

API_KEY = Your Private API Key # required
SCAN_ID = Your scan id # required

Returns Immediate response similar to callback response

Errors

Possible error messages

UNKWONW_API_KEY : check your API key is corectly set in config.php ([Get your API Key](https://www.killduplicate.com/en/user/api))
UNAUTHORIZED_IP : check IP where script is run from is added to whitelist ([Chech Authorized IPs](https://www.killduplicate.com/en/user/api))
TOO_MANY_REQUESTS : only one request per second is allowed
NO_MORE_CREDITS : you dont' have enough credits to run this scan
EMPTY_TEXT_AND_URL : neither text nor url were provided
INTERNAL_ERROR : internal server error (please contact admin)
UNKNOWN_FORMAT : can only be json|xml
INVALID_CALLBACK_URL : invalid callback URL 

UTF-8 encoding

All texts MUST be encoded in VALID UTF-8. If you load some old Microsoft Words Documents you might have invalid UTF-8 characters like strange quotes. To be sure you have valid UTF-8 encoded texts you can check it :

$validUTF8 = ! (false === mb_detect_encoding($text, 'UTF-8', true));

If your text has invalid UTF-8 characters, you can use some home made functions to convert invalid encoding (problem is that some characters in some encodings can be converted into multiple UTF-8 characters you have to unilateraly decide to which character it will be converted to ... and that's why it's your responsability to make UTF-8 conversion when you use API) : Gist Clean UTF-8, or you can make you own.

HTML entities

Your texts MUST be send WITHOUT HTML entities (You can use PHP function html_entity_decode)

Troubleshouting

Be sure your callback is reachable over the network.

For file permission issues (replace www-data by your webserver username)

chown -R www-data:www-data vendor/impact-seo/killduplicate-api-php/results
chmod -R 775 vendor/impact-seo/killduplicate-api-php/results

impact-seo/killduplicate-api-php 适用场景与选型建议

impact-seo/killduplicate-api-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 736 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 03 月 31 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「content」 「duplicate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 impact-seo/killduplicate-api-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 impact-seo/killduplicate-api-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 impact-seo/killduplicate-api-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 736
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-31