Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Curl Class
  • Hi all. I've started implementing a Curl class for Fuel based on Phil's codeigniter-curl library. You can view the project on Github: Since I am using git-flow, development is currently on the "feature/curl" branch. Basic features will include:
    * simple get/post/put/delete (e.g., one function call)
    * complex get/post/put/delete (e.g., initialize, configure, execute)
    * proxy tunneling
    * ssl
    * cookie data
    * http authentication
    * performance (overhead is currently an acceptable 0.001s) Verification of "PUT" would be most helpful as I am unable to find a canonical "this always works" example. -Jeremy
  • You've done a good job porting this from CI to Fuel but this is not the way I would have done it. Fuel supports the idea of "Static for Simple, Instantiate to get more involved" so a lot of this syntax could be simplified drastically. Instantiate the object and you can set up the url, set options, method chain a bunch of stuff, etc, but if you want quickfire you should be able to do this with a one-liner:

    The other reason I was yet to do this is that I like the way Kohana has built their Request class to handle this seamlessly using stream wrappers and header manipulation withing fopen() etc. It would be nice to set a URL, a bunch of headers and options then have it returned regardless of if cURL is installed / compiled or not.
  • Thanks for your input. It didn't even occur to me that I could use chaining within the class. Also, I agree that it doesn't make sense to have to create an object in order to perform a single function when you have static methods available. Of most interest is your comment about using streams instead of cURL. Since I didn't want to reinvent the wheel it makes sense to me to use what I have already, namely libcurl. On the other hand, the framework should probably try to stay away from distributing code that depends on extra libraries (such as libcurl). Perhaps you'll need to focus on creating an "httprequest" class instead of a "curl" class. I'll post updates here as I modify the code to be more in the Fuel-style.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion