PHP 클래스 BaiduApiClient, thinksns

저자: zhujianting([email protected])
파일 보기 프로젝트 열기: medz/thinksns-4 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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 )

메소드 상세

__construct() 공개 메소드

Constructor
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.

api() 공개 메소드

Call an api which is opened by Baidu, file upload apis should not be called by this interface.
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.

beginBatch() 공개 메소드

Start a batch operation.
public beginBatch ( )

end_batch() 공개 메소드

End current batch operation
public end_batch ( )

getAccessToken() 공개 메소드

Get the access token for the following api calls.
public getAccessToken ( ) : string
리턴 string

getClientId() 공개 메소드

Get the client_id.
public getClientId ( ) : string
리턴 string

getFinalEncode() 공개 메소드

Get the charset of the app.
public getFinalEncode ( ) : string
리턴 string

iconv() 공개 정적인 메소드

public static iconv ( $var, $inCharset = 'UTF-8', $outCharset = 'GBK' )

setAccessToken() 공개 메소드

Set access token for the following api calls.
public setAccessToken ( string $accessToken ) : BaiduApiClient
$accessToken string
리턴 BaiduApiClient

setBatchMode() 공개 메소드

Set the mode of batch/run api.
public setBatchMode ( integer $batchMode ) : BaiduApiClient
$batchMode integer Use BaiduApiClient::BATCH_MODE_SERVER_PARALLEL or BaiduApiClient::BATCH_MODE_SERIAL_ONLY
리턴 BaiduApiClient

setClientId() 공개 메소드

Set the client_id.
public setClientId ( string $clientId ) : BaiduApiClient
$clientId string Client_id of the baidu thirdparty app or access_key of the developer.
리턴 BaiduApiClient

setFinalEncode() 공개 메소드

Set the charset for the app.
public setFinalEncode ( string $finalEncode ) : BaiduApiClient
$finalEncode string 'UTF-8' or 'GBK'
리턴 BaiduApiClient

upload() 공개 메소드

Call a file upload api.
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.

프로퍼티 상세

$BD_OPENAPI_DEFAULT_DOMAINS 공개적으로 정적으로 프로퍼티

Scheme & domain for Baidu OpenAPI interfaces.
public static $BD_OPENAPI_DEFAULT_DOMAINS

$BD_OPENAPI_DEFAULT_PREFIXS 공개적으로 정적으로 프로퍼티

URL prefixs for Baidu OpenAPI interfaces.
public static $BD_OPENAPI_DEFAULT_PREFIXS

$accessToken 보호되어 있는 프로퍼티

protected $accessToken

$batchMode 보호되어 있는 프로퍼티

Mode of batch/run api
protected int $batchMode
리턴 integer

$batchQueue 보호되어 있는 프로퍼티

Array of api calls to be batch run.
protected array $batchQueue
리턴 array

$clientId 보호되어 있는 프로퍼티

protected $clientId

$finalEncode 보호되어 있는 프로퍼티

Charset of the app pages, default is UTF-8
protected $finalEncode