PHP code example of hedeqiang / antispam
1. Go to this page and download the library: Download hedeqiang/antispam library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hedeqiang / antispam example snippets
use Hedeqiang\Antispam\Antispam;
$config = [
'account' => [
'secretId' => '',
'secretKey' => '',
],
'text' => [
'businessId' => '',
],
'image' => [
'businessId' => '',
],
'audio' => [
'businessId' => '',
],
'video' => [
'businessId' => '',
],
];
$antispam = new Antispam($config);
$response = $antispam->textScan(['content' => 'XXX']);
or
$params = [
'content' => 'XXX','title' => 'XXX','dataId' => 123 ...
]; // 可只传 content 字段。 dataId、version 本 SDK 已经做处理,可传可不传
$extras = [
'ip' => '10.0.0.1',
'account' => 'hedeqiang',
...
]; // 此参数可不传
$response = $antispam->textScan($params,$extras);
$texts = [
['content' => 'XXX','title' => 'XXX',...],
['content' => 'XXX','title' => 'XXX',...]
]; // 可以只填 Y 的值 。dataId 可不传
$extras = [
'ip' => '10.0.0.1',
'account' => 'hedeqiang',
...
]; // 此参数可不传
$response = $antispam->textBatchScan($params,$extras);
$response = $antispam->textCallback();
$feedback = [
['taskId' => 'e8e13a01024345db8e04c0dfaed2ec50','version' => 'v1','level' => 0,'label' => 100]
];
$response = $antispam->textFeedback($feedback);
$params = [
'category' => '100',
'keywords' => 'XXX,XXX,XXX,XXX,XXX,XXX,XXX'
];
$response = $antispam->addKeyWorld($params);
$ids =['23234140','23234141'];
$response = $antispam->delKeyWorld($ids);
$response = $antispam->textQuery();
// 也可传入制定参数
$params = [
'id' => '23223254',
'keyword' => 'XXX',
'category' => 100,
'orderType' => 1,
'pageNum' => 100,
'pageSize' => 10,
];
$response = $antispam->textQuery($params);
$images = [
['name' => '','type' => '','data' => '','callbackUrl' => ''],
['name' => '','type' => '','data' => '','callbackUrl' => ''],
['name' => '','type' => '','data' => '','callbackUrl' => ''],
['name' => '','type' => '','data' => '','callbackUrl' => ''],
];
// array $checkLabels = [],array $extras = []
$response = $antispam->imageScan($images);
php artisan vendor:publish --tag=antispam
use Hedeqiang\Antispam\Antispam;
public function index(Antispam $antispam)
{
$response = $antispam->textScan();
}
public function index()
{
$response = app('antispam')->textScan();
}
use Hedeqiang\Antispam\Facades\Antispam;
$response = Antispam::green()->textScan();