Свойство | Тип | Описание | |
---|---|---|---|
$_encode | default is json | ||
$api_url | #Set up the API root URL. | ||
$connecttimeout | #Set connect timeout. | ||
$decodeFormat | Only support json & xml for extension | ||
$format | #Response format. | ||
$http_code | #Contains the last HTTP status code returned. | ||
$http_header | |||
$http_info | #Contains the last HTTP headers returned. | ||
$ssl_verifypeer | #Verify SSL Cert. | ||
$timeout | #Set timeout default. |
Метод | Описание | |
---|---|---|
_DELETE ( $url, $params = null, $username = null, $password = null ) : RESTClient | DELETE wrapper for delete data | |
_GET ( $url, $params = null, $username = null, $password = null ) : RESTClient | GET wrapper for get data | |
_POST ( $url, $params = null, $username = null, $password = null, $contentType = null ) : RESTClient | POST wrapper for insert data | |
_POST_FOPEN ( $url, $params = null, $username = null, $password = null, $contentType = null ) | ||
_PUT ( $url, $params = null, $username = null, $password = null, $contentType = null ) : RESTClient | PUT wrapper for update data | |
__construct ( ) | ||
_photoUpload ( $url, $postdata, $files ) | ||
call ( $url, $method, $postFields = null, $username = null, $password = null, $contentType = null ) : RESTClient | Execute calls | |
call_fopen ( $url, $method, $postFields = null, $username = null, $password = null, $contentType = null ) | ||
close ( ) | Closes the connection and release resources | |
convertEncoding ( $source, $in, $out ) | ||
create_post_body ( $post_params ) | ||
do_post_request ( $url, $postdata, $files ) : mixed | POST wrapper,不基于curl函数,环境可以不支持curl函数 | |
getHeader ( $ch, $header ) | Get the header info to store. | |
get_http_url ( ) | parses the url and rebuilds it to be scheme://host/path | |
json_foreach ( $jsonArr ) | 将stdclass object转换成数组,并转换编码 | |
objectToArray ( $obj ) | ||
parseResponse ( $resp, $ext = '' ) | * Parse response, including json, xml, plain text | |
setAuthorizeInfo ( $username, $password ) | Set the authorize info for Basic Authentication | |
setContentType ( string $contentType ) | Set the Content-Type of the request to be send Format like "application/json" or "application/xml" or "text/plain" or other | |
setDecodeFormat ( $format = null ) : boolean | Sets the format type to be decoded | |
setEncode ( $encode ) | ||
setFormat ( $format = null ) : boolean | Sets the format type to be extension | |
setMethod ( $method ) | Set the Request HTTP Method | |
setNotFollow ( ) : RESTClient | Settings that won't follow redirects | |
setParameters ( $params ) | Set Parameters to be send on the request It can be both a key/value par array (as in array("key"=>"value")) or a string containing the body of the request, like a XML, JSON or other Proper content-type should be set for the body if not a array | |
setURL ( $url ) | Sets the URL to be Called | |
to_postdata ( ) | builds the data one would send in a POST request | |
to_url ( ) | builds a url usable for a GET request | |
xml_decode ( $data, $toArray = false ) | * XML decode |
public _DELETE ( $url, $params = null, $username = null, $password = null ) : RESTClient | ||
$url | String | |
$params | mixed | |
$username | String | |
$password | String | |
Результат | RESTClient |
public _GET ( $url, $params = null, $username = null, $password = null ) : RESTClient | ||
$url | String | |
$params | mixed | |
$username | String | |
$password | String | |
Результат | RESTClient |
public _POST ( $url, $params = null, $username = null, $password = null, $contentType = null ) : RESTClient | ||
$url | String | |
$params | mixed | |
$username | String | |
$password | String | |
$contentType | String | |
Результат | RESTClient |
public _POST_FOPEN ( $url, $params = null, $username = null, $password = null, $contentType = null ) |
public _PUT ( $url, $params = null, $username = null, $password = null, $contentType = null ) : RESTClient | ||
$url | String | |
$params | mixed | |
$username | String | |
$password | String | |
$contentType | String | |
Результат | RESTClient |
public call ( $url, $method, $postFields = null, $username = null, $password = null, $contentType = null ) : RESTClient | ||
$url | String | |
$method | String | |
$postFields | String | |
$username | String | |
$password | String | |
$contentType | String | |
Результат | RESTClient |
public call_fopen ( $url, $method, $postFields = null, $username = null, $password = null, $contentType = null ) |
public do_post_request ( $url, $postdata, $files ) : mixed | ||
Результат | mixed |
public get_http_url ( ) |
public parseResponse ( $resp, $ext = '' ) | ||
$resp | String | |
$ext | String, including json/xml |
public setAuthorizeInfo ( $username, $password ) | ||
$username | String | |
$password | String |
public setContentType ( string $contentType ) | ||
$contentType | string |
public setDecodeFormat ( $format = null ) : boolean | ||
$format | String | |
Результат | boolean |
public setNotFollow ( ) : RESTClient | ||
Результат | RESTClient |
public setParameters ( $params ) | ||
$params | mixed |
public to_postdata ( ) |
public static xml_decode ( $data, $toArray = false ) | ||
$data | String | |
$toArray | boolean, true for make it be array |