프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$BD_OPENAPI_DEFAULT_DOMAINS | Scheme & domain for Baidu OpenAPI interfaces. | ||
$BD_OPENAPI_DEFAULT_PREFIXS | URL prefixs for Baidu OpenAPI interfaces. |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$accessToken | |||
$batchMode | integer | Mode of batch/run api | |
$batchQueue | array | Array of api calls to be batch run. | |
$clientId | |||
$finalEncode | Charset of the app pages, default is UTF-8 |
메소드 | 설명 | |
---|---|---|
__construct ( string $clientId, string $accessToken ) | Constructor | |
api ( string $uri, array $params = [], string $httpMethod = 'GET', string $type = 'rest' ) : array | false | Call an api which is opened by Baidu, file upload apis should not be called by this interface. | |
beginBatch ( ) | Start a batch operation. | |
end_batch ( ) | End current batch operation | |
getAccessToken ( ) : string | Get the access token for the following api calls. | |
getClientId ( ) : string | Get the client_id. | |
getFinalEncode ( ) : string | Get the charset of the app. | |
iconv ( $var, $inCharset = 'UTF-8', $outCharset = 'GBK' ) | ||
setAccessToken ( string $accessToken ) : BaiduApiClient | Set access token for the following api calls. | |
setBatchMode ( integer $batchMode ) : BaiduApiClient | Set the mode of batch/run api. | |
setClientId ( string $clientId ) : BaiduApiClient | Set the client_id. | |
setFinalEncode ( string $finalEncode ) : BaiduApiClient | Set the charset for the app. | |
upload ( string $uri, $params = [] ) : Returns | Call a file upload api. |
메소드 | 설명 | |
---|---|---|
batchRun ( ) | ||
converJson2Array ( $json ) | ||
doBatchRun ( $useHttps = true ) |
public __construct ( string $clientId, string $accessToken ) | ||
$clientId | string | Client_id of the baidu thirdparty app or access_key of the developer. |
$accessToken | string | Access token for api call. |
public api ( string $uri, array $params = [], string $httpMethod = 'GET', string $type = 'rest' ) : array | false | ||
$uri | string | Uri for the api, it could be the whole url, like 'https://openapi.baidu.com/rest/2.0/passport/user/info/get', or url path only, like '/rest/2.0/passport/user/info/get', or just api method only, like 'passport/user/info/get'. |
$params | array | Api specific parameters. |
$httpMethod | string | Http method, could be 'GET' or 'POST'. |
$type | string | Type name of the openapi, could be 'rest', or 'public'. |
리턴 | array | false | Returns an array if success, or false if failed. |
public getAccessToken ( ) : string | ||
리턴 | string |
public setAccessToken ( string $accessToken ) : BaiduApiClient | ||
$accessToken | string | |
리턴 | BaiduApiClient |
public setBatchMode ( integer $batchMode ) : BaiduApiClient | ||
$batchMode | integer | Use BaiduApiClient::BATCH_MODE_SERVER_PARALLEL or BaiduApiClient::BATCH_MODE_SERIAL_ONLY |
리턴 | BaiduApiClient |
public setClientId ( string $clientId ) : BaiduApiClient | ||
$clientId | string | Client_id of the baidu thirdparty app or access_key of the developer. |
리턴 | BaiduApiClient |
public setFinalEncode ( string $finalEncode ) : BaiduApiClient | ||
$finalEncode | string | 'UTF-8' or 'GBK' |
리턴 | BaiduApiClient |
public upload ( string $uri, $params = [] ) : Returns | ||
$uri | string | Uri for the api, it could be the whole url, like 'https://openapi.baidu.com/file/2.0/cloudalbum/picture/upload', or just api method only, like 'cloudalbum/picture/upload', if the api is provided under the domain of openapi.baidu.com. |
$params | Api specific parameters. | |
리턴 | Returns | an array if success, or false if failed. |
public static $BD_OPENAPI_DEFAULT_DOMAINS |
public static $BD_OPENAPI_DEFAULT_PREFIXS |