Yii 1.1: restclient

Port of CodeIgniter REST client and CURL library
17 followers

Most of the code is from Phil Sturgeon CodeIgniter.

Usage

Just extract the 2 files into ext.components.

cURL Component example

$curl = new CURL();
$html = $curl->simple_get('http://www.google.com/');

RESTClient example

$rest = new RESTClient();
$rest->initialize(array('server' => 'http://twitter.com/'));
$tweet = $rest->get('statuses/user_timeline/'.$username.'.xml');

Resources

Original Libraries: * CI CURL Library * RESTClient

Total 9 comments

#14941 report it
Zcasper at 2013/09/23 10:27am
Version of library

Author, please versioning you library.

#11678 report it
Mr Pelle at 2013/01/26 04:40pm
PR available for bug reported by Thim (#5953)

I created a PR from your bugfix, thank you for reporting it!

#6319 report it
Haensel at 2011/12/29 05:20am
private variables/methods

Hi,

Thanks for your efforts. I really like the RESTClient but I needed some customized methods and thus had to completely rewrite the whole class because every variable/method is defined as private. Phil doesn't do that in his code (he uses protected instead) so I wasn't sure about your intentions. Maybe there is a reason behind that. If not I would recommend making things more flexible with protected/public where possible.

Anyway, thanks for your extension

#5953 report it
Thim at 2011/11/28 06:21pm
restclient error

Hi

try adding line 46 in the RESTClient.php

private $_headers = array();
#5952 report it
Thim at 2011/11/28 05:46pm
more info needed

Hi guys,

How can I get this working correctly? May be a little more info how to use it.

In my controller I tried:

$rest = new RESTClient(); or $rest = Yii::app()->RESTClient();

but get the following message.

Include(restclient.php) [function.include]: failed to open stream: No such file or directory

even when I add the path in my config/main.php

// application components
    'components'=>array(
'RESTClient' => array(
            'class' => 'application.extensions.RESTClient',
        ),

I found it: make sure that the extensions directory is included in the import array

// autoloading model and component classes
    'import'=>array(
        ....
        'application.extensions.*'
    ),
#4688 report it
dfu at 2011/08/04 06:17am
restclient error

Hi,

Thank you for this extension. It is what Im needing.

CURL component works fine, but restclient is dropping an error whenever i try to use your example:

$rest = new RESTClient();

array_key_exists() expects parameter 2 to be array, null given /public_html/protected/extensions/RESTClient.php(256)

May be im missing something

Thank you again

#4293 report it
dinhtrung at 2011/06/22 08:35pm
License Updated

I have inform Phil about the porting of his code. Also, change the header to keep the original header as well. :)

#4292 report it
dinhtrung at 2011/06/22 08:22pm
Thanks, I'll feedback to Phil about this

:)) Actually, after reading your comments, I read the license at the link as well. :)) Never thought there could be such a license! :)) I'll notify Phil about this porting as well.

#4290 report it
intel352 at 2011/06/22 03:23pm
Incorrect license

Not to be a stickler, but the license for the original libs published by Phil, is the DBAD license (not New BSD). Humorous, yes, but still it's licensed already.

As a result, you should change the licensing to reflect "Other Open Source license", and reference this link for the proper license: http://philsturgeon.co.uk/code/dbad-license

Make sure it's intact in your code as well, if not already so.

The license doesn't actually matter to me, but I know there are quite a few users in the Yii community that do and don't use contributed code, based on the license.

Additionally, the incorrect licensing may matter to Phil.

Really it'd be nice to see both extensions released separately (instead of combined), so someone can install just the curl ext if desired, but you've filled a nice gap in the Yii code base regardless.

Cheers

Leave a comment

Please to leave your comment.

Create extension