rogeriopradoj / codeigniter-restclient
此软件包最新版本(2.1.1)没有可用的许可证信息。
通过 composer 使用 philsturgeon 的 codeigniter-restclient 库
2.1.1
2013-05-27 21:23 UTC
This package is not auto-updated.
Last update: 2024-09-23 14:54:47 UTC
README
CodeIgniter-REST Client 是一个 CodeIgniter 库,可以轻松地使用 REST 服务/API,如 Twitter、Facebook 和 Flickr,无论它们是公开的还是隐藏在 HTTP Basic/Digest 之后的。
要求
- PHP 5.1+
- CodeIgniter 2.0.0+
- cURL
- CodeIgniter Curl 库: http://getsparks.org/packages/curl/show
用法
// Load the rest client spark
$this->load->spark('restclient/2.1.0');
// Load the library
$this->load->library('rest');
// Run some setup
$this->rest->initialize(array('server' => 'http://twitter.com/'));
// Pull in an array of tweets
$tweets = $this->rest->get('statuses/user_timeline/'.$username.'.xml');
这显然是一个非常简单的例子,还有很多更多的事情可以用它来完成。查看代码以了解有关 api_key() 和其他 post/put/delete 方法等内容。