PHP code example of upyun-banma / sdk

1. Go to this page and download the library: Download upyun-banma/sdk 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/ */

    

upyun-banma / sdk example snippets



use Banma\UpYun;
// 初始化 UpYun
$upyun = new UpYun ('ClientKey', 'ClientSecret','/image/url/check');//参数获取可以参考文档:http://docs.upyun.com/ai/audit/ /image/url/check 是你需要请求的接口 URI 。 

$data = array(
    'url' => 'http://demo.b0.upaiyun.com/demo.png',        // 鉴黄的URL
    'notify_url' => 'http://notify.http.com/post',      //回调通知地址
);
// 调用拉取函数
try {
    //返回对应的任务ids
    $ids = $upyun->request($data);
    print $ids;
} catch(Exception $e) {
    echo $e->getCode();     // 错误代码
    echo $e->getMessage();  // 具体错误信息
}