Posted 04 October 2012 - 11:06 AM
just made this simple Curl wrapper for yii. i've seen one in extensions earlier, but wanted one which is light weight and simpler to use for my project, so made this one.
it's on github
thanks for your feedbacks in advance
Posted 04 October 2012 - 11:35 AM
Check my extension
giix: a code generator for Yii.
The complete beginner's study guide for the Yii Framework
Posted 15 January 2013 - 02:43 PM
"Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' "
$output = Yii::app()->curl->init();
I looked at the package, it seems pretty simple. I can execute curl calls from the command line but it seems
that my package is not configured or something of the sort.
My main.php in config is set like this. Not sure what options I need to set...the init() should be setting them.
'curl' => array( 'class' => 'ext.Curl', //'options' => array(/.. additional curl options ../) );
The examples with the yii-curl wrapper were pretty simplistic so maybe I misinterpreted them.
Posted 15 January 2013 - 04:06 PM
I'm on Ubuntu 12.04LTS / NGINX / PHP5 / MySQL
I did do an install php5-curl and it seemed to work cambe back with setting up php5-curl (so it wasn't installed before)
I have been using curl from the command line recently in preparation for this project.
I don't see it when I issue phpinfo()...it comes back with alot of stuff, would curl be in it's own block
right after "core" parameters?
Posted 17 January 2013 - 02:02 AM
You were correct.
php_curl needed to be installed, it gave me a bit of difficulty but I think the problem was having to reboot the server
before the module showed up...Maybe I just needed to restart the webserver...
Works like a charm, thanks again for your help!
Posted 24 January 2013 - 11:30 AM
I was trying to use this extension. I created a json string and posted it to authorize a connection. That worked.
I need to send a token with the GET command but not sure how to do it. curl -H "Authorization:12132455dae234234" 'http://api.site.com/getdata'
I could also use a cookie but not sure how to set it up. curl -b cookie 'http://api.site.com/getdata' ;
The way parameters work in the get() they are a suffix to the url. get(url,params)
Any suggestions? Thanks !
This worked for me....
$auth = array('Authorization:'.$token); $jsonObject = Yii::app()->curl->setOption(CURLOPT_HTTPHEADER, $auth)->get($url);