plagtracker/api-client

此软件包最新版本(0.1.0)没有可用的许可证信息。

api.plagtracker.com的php客户端

0.1.0 2015-05-01 15:38 UTC

This package is not auto-updated.

Last update: 2024-10-02 07:34:28 UTC


README

API文档

http://plagtracker.github.io/api-client/

安装

{
    "require": {
        "plagtracker/api-client": "0.1.*"
    }
}

用法

创建客户端

$client = new \Plagtracker\Api\Client('login', 'password');

添加要检查的文本

$response = $client->addTextForChecking('text');
if($response->isSuccessfully())
{
    $hash = $response->getData();
}
else
{
    echo 'ERROR: ' . $response->getMessage();
}

添加要检查的URL

$response = $client->addUrlForChecking('http://example.com');
$hash = $response->getData();

添加要检查的文件

$response = $client->addFileForChecking('/path/to/file');
$hash = $response->getData();

获取文本状态

$response = $client->getTextStatus($hash);
if($response->isSuccessfully())
{
    $completedPercent = $response->getData();
}
else
{
    echo 'ERROR: ' . $response->getMessage();
}

获取结果

if($completedPercent == 100)
{
    $response = $client->getResult($hash);
    if($response->isSuccessfully())
    {
        $result = $response->getData();
    }
    else
    {
        echo 'ERROR: ' . $response->getMessage();
    }
}

获取抄袭百分比

$response = $client->getPlagiarismPercent($hash);
if($response->isSuccessfully())
{
    $plagiarismPercent = $response->getData();
}
else
{
    echo 'ERROR: ' . $response->getMessage();
}

获取文本

$response = $client->getText($hash);
if($response->isSuccessfully())
{
    $text = $response->getData();
}
else
{
    echo 'ERROR: ' . $response->getMessage();
}