Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Move mcurl.php to your libraries folder. To view the examples in your applicatio
// add_call( KEY, METHOD, URL, array of PARAMS, array of CURL_OPTS )
$this->mcurl->add_call("call1","get","http://google.com");
$this->mcurl->add_call("call2","post","http://twitter.com");
$this->mcurl->add_call("call3","get","http://google.com",array("q"=>"codeigniter"));
$this->mcurl->add_call("call4","get","https://facebook.com",array(),array(CURLOPT_SSL_VERIFYPEER => FALSE));
$this->mcurl->add_call("call3","put","http://twitter.com");
$this->mcurl->add_call("call4","delete","http://twitter.com");
$this->mcurl->add_call("call5","get","http://google.com",array("q"=>"codeigniter"));
$this->mcurl->add_call("call6","get","https://facebook.com",array(),array(CURLOPT_SSL_VERIFYPEER => FALSE));

// execute the calls
$responses = $this->mcurl->execute();
Expand Down
14 changes: 14 additions & 0 deletions application/libraries/mcurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* @category Libraries
* @author Chad Hutchins
* @link http://github.com/chadhutchins/codeigniter-mcurl
* @forkedBy Mohannad F. Otaibi
* @fork https://github.com/Mo9a7i/codeigniter-mcurl
*/

class Mcurl {
Expand Down Expand Up @@ -108,6 +110,18 @@ function add_call($key=null, $method, $url, $params = array(), $options = array(
curl_setopt($this->calls[$key]["curl"], CURLOPT_POSTFIELDS, $params);
break;

case "PUT":
curl_setopt($this->calls[$key]["curl"], CURLOPT_URL, $url);
curl_setopt($this->calls[$key]["curl"], CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($this->calls[$key]["curl"], CURLOPT_POSTFIELDS, $params);
break;

case "DELETE":
curl_setopt($this->calls[$key]["curl"], CURLOPT_URL, $url);
curl_setopt($this->calls[$key]["curl"], CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($this->calls[$key]["curl"], CURLOPT_POSTFIELDS, $params);
break;

case "GET":
curl_setopt($this->calls[$key]["curl"], CURLOPT_URL, $url."?".$params);
break;
Expand Down