Coder Social home page Coder Social logo

codeigniter-curl's People

Contributors

alexbilbie avatar chadhutchins avatar jimmypuckett avatar philsturgeon avatar pwhelan avatar rhbecker avatar ricick avatar serzhenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeigniter-curl's Issues

Notice Error "Undefined property: Curl::$last_response"

If you run the debug() method after a failed curl request, a notice pops up about Curl::$last_response not being defined. I fixed this by just adding a declaration for it in the class definition:

protected $last_response = '';  // Cached response

no "get" method?

If I use "simple_get" it doesn't exist, so it hits "__call" but when it tries to invoke the method get (line 62) there is still no "get" method... I see "post" defined. Did this get lost somehow?

CURLOPT_FAILONERROR and simple_get

Just want to mention that some APIs return error codes 400 or greater. A response message is returned by the API which would be useful, (in this instance the http code was 400 and the error was an xml string), but because of the CURLOPT_FAILONERROR (which defaults to true for simpleget and can not be changed via that call), the response from the curl class is FALSE.

I figured this out pretty quickly and created a custom request:

        $this->ci->curl->create($query_string);
        $this->ci->curl->option('FAILONERROR', FALSE);
        $request = $this->ci->curl->execute();

So that works, and it's simple. This perhaps should be noted in the README, or a second param with options could be available for simple_get.

simple_get arguments

I just want to mention that when using simple_get with curl options, the second argument must be set to a NULL to indicate that no url parameters in the arguments

$this->curl->simple_get('http://example.com', array(CURLOPT_PORT => 8080));
is erroneous, since it treats the curl options array as $params

the correct one would be...
$this->curl->simple_get('http://example.com', NULL, array(CURLOPT_PORT => 8080));

Hope this should be reflected in the manual...

Unfamiliar Syntax

Hey Phil,

I'm just curious because I haven't seen it before, but what is line #39 in /libraries/Curl.php doing?

Thanks,
Chad

$this->response is cleared before debug

Hey Phil! Love the lib - use it for all my cURL stuffs. :)

Just wanted to point out that when you run:

$this->curl->debug();

The "response" section will always be empty since

$this->set_defaults();

Is always run after closing the connection. Perhaps removing $this->response from the set_default() method would be the best fix? Unless there's a good reason for resetting it for big responses and such.

cache pls

Would u pls add the get requests cache feature? thanks

Doesn't work for downloading to files

The execute method sets the CURLOPT_RETURNTRANSFER; for some reason this breaks downloading to files.

This produces a file with 0KB:

            $file = fopen($path, 'w');
            $this->curl->create($url);
            $this->curl->option('file', $file);
            $this->curl->execute();
            fclose($file);

This works:

            $curl = curl_init($url);
            $fp = fopen($filename, "w");
            curl_setopt($curl, CURLOPT_FILE, $fp);
            curl_exec ($curl);
            curl_close ($curl);
            fclose($fp);

curl execution timeout issue

$get_url = "neo4j_sync/actions.php/coursecluster_includes_course/";
$res = $this->curl->simple_get($get_url, false, array(
CURLOPT_USERAGENT => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_RETURNTRANSFER => true
));

if u see above curl call CURLOPT_TIMEOUT is set to 0 , but im still getting time execution exceeds 300 seceonds error
and even i added " ini_set('max_execution_time', 0); " on top of the code but still facing same issue .. i'm not able to resolve this problem ... please help me out

Sending files with @path format doesn't work fine

The PHP-Curl library uses one special escape sequence to send binary files within the posts request.
This '@' character is encoded before submitting the request, then files are sent as a regular POST parameter.

Issue with requested URL - base URL is included in request URL

Hi Phil,

Am I doing something wrong or this is issue with lib ?

I'm simply trying to get info from twitter webservice.

Issue is with URL request - it contain my base url which cause 404.

I'm using nginx webserver with php fpm 5.3.6-13ubuntu3.7.

Here is my debug output:

Array
(
[url] => http://localhost:81/index.php/http:twitter.com/statuses/user_timeline/ibmpw.xml
[content_type] => text/html
[http_code] => 404
[header_size] => 154
[request_size] => 110
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.000757
[namelookup_time] => 0.000321
[connect_time] => 0.000481
[pretransfer_time] => 0.000486
[size_upload] => 0
[size_download] => 168
[speed_download] => 221928
[speed_upload] => 0
[download_content_length] => 168
[upload_content_length] => 0
[starttransfer_time] => 0.000725
[redirect_time] => 0
[certinfo] => Array
(
)

[request_header] => GET /index.php/http:twitter.com/statuses/user_timeline/ibmpw.xml HTTP/1.1
Host: localhost:81
Accept: /

)

Thx,
Vukasin

P.S.

Here is my lib call:

autoload.php

$autoload['libraries'] = array('database', 'session','rest');
In controller:

$this->rest->initialize(array('server' => 'http:twitter.com/'));

$tweets = $this->rest->get('statuses/user_timeline/ibmpw.xml');

Create a method for adding http-headers from an array

I am reworking code that initially dealed with curl_* functions directly. Now I want to use this library.

I have got my http-headers for my request prepared as an arrays. But there is no a convenient way (there is no a method) for passing them directly.

Here are my headers:
array(5) { [0]=> string(38) "Content-type: text/xml;charset="utf-8"" [1]=> string(23) "Cache-Control: no-cache" [2]=> string(16) "Pragma: no-cache" [3]=> string(58) "SOAPAction: "http://............"" [4]=> string(22) "Connection: Keep-Alive" }

Here are the options I could use now:
protected $headers = array(); // -- This property is not accessible and it should not be ("ugly hackish way").
public function http_header($header, $content = NULL) // -- This method allows me to pass my headers one by one only. I am forced here to cycle and parse my array of headers.

Is it possible a hew method to be created for adding several headers from an array?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.