Skip to content

danielrsmith/php-restclient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

PHP REST Client

(c) 2011 Travis Dent [email protected]

Usage

$api = new RestClient(
    'base_url' => "http://api.twitter.com/1/", 
    'format' => "json"
);
$result = $api->get("statuses/public_timeline");
if($result->info->http_code == 200)
    json_decode($result->response);

Configurable Options

headers - An associative array of HTTP headers and values to be included in every request.
curl_options - cURL options to apply to every request. These will override any internally generated values.
user_agent - User agent string.
base_url - URL to use for the base of each request.
format - Format to append to resource.
username - Username to use for basic authentication. Requires password.
password - Password to use for basic authentication. Requires username.

Options can be set upon instantiation, or individually afterword:

$api = new RestClient(array(
    'format' => "json", 
    'user_agent' => "my-application/0.1"
));

-or-

$api = new RestClient;
$api->set_option('format', "json");
$api->set_option('user_agent', "my-application/0.1");

About

A generic REST API client for PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%