Git Product home page Git Product logo

smntb / codeigniter-mcurl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chadhutchins/codeigniter-mcurl

0.0 1.0 0.0 889 KB

A codeigniter library to help make using multi curl functionality easier. Multi curl alows you to make multiple curl requests simultaneously, without having to process each curl request one after another. This library is great if you're having to make multiple web API calls to one or more APIs.

PHP 100.00%

codeigniter-mcurl's Introduction

mcurl - Codeigniter library for multi-curl functionality

Overview

A codeigniter library to help make using multi curl functionality easier. Multi curl alows you to make multiple curl requests simultaneously, without having to process each curl request one after another. This library is great if you're having to make multiple web API calls to one or more APIs.

How to use it

Move mcurl.php to your libraries folder. To view the examples in your application, move example.php to your controllers folder and point your app to http://your_app/index.php/example

$this->load->library('mcurl');

// 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));

// execute the calls
$responses = $this->mcurl->execute();

// retrieve a specific call by key
// this will return the response of the google.com request
$response = $this->mcurl->calls["call1"]["response"];

// available data to use
$this->mcurl->calls["key"]["method"]; // the method POST/GET used in request
$this->mcurl->calls["key"]["url"]; // the uri of the request
$this->mcurl->calls["key"]["params"]; // the data parameters sent in request
$this->mcurl->calls["key"]["options"]; // the curl options used in the request
$this->mcurl->calls["key"]["curl"]; // the php curl object
$this->mcurl->calls["key"]["response"]; // the response of the request
$this->mcurl->calls["key"]["error"]; // if not null, there are some errors

// show some debugging on all calls
$this->mcurl->debug();

See the Example controller in the code for more details.

codeigniter-mcurl's People

Contributors

chadhutchins avatar sebdesign avatar

Watchers

Nouman Tayyab avatar

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.