rde / api
跨系統用api
v1.0.4
2015-08-25 06:07 UTC
Requires
- php: >=5.3.0
- nategood/httpful: ~0.2
Requires (Dev)
- phpunit/phpunit: ~4
This package is not auto-updated.
Last update: 2024-11-09 18:07:33 UTC
README
建構基本 api 溝通物件
$api = new Rde\Api(array( 'protocol' => Rde\Api::guessProtocol(), 'host' => Rde\Api::guessHost(), 'ip' => Rde\Api::guessIp(), 'port' => Rde\Api::guessPort(), 'path' => 'base/api/path', 'auth_basic_user' => 'xxx', 'auth_basic_pwd' => 'xxxxxxxxxxx', )); $data = $api->get( 'test/api', array("a" => "b"), function($body, $response, array("method" => 'GET', "payload" => array("a" => "b"))){ // accept callback }, function($code, $err_msg, $res_raw_body, $exception){ // reject callback }, function($request){ // profile callback // just for test } );