Skip to content

dcai/curl

Repository files navigation

curl wrapper class for PHP

A PHP wrapper class to simplify PHP cURL Library.

How to use

Following code shows how to use this class

$http = new dcai\curl;
// enable cache
$http = new dcai\curl(array('cache'=>true));
// enable cookie
$http = new dcai\curl(array('cookie'=>true));
// enable proxy
$http = new dcai\curl(array('proxy'=>true));

// HTTP GET
$response = $http->get('http:https://example.com');
// HTTP POST
$response = $http->post('http:https://example.com/', array('q'=>'words', 'name'=>'moodle'));
// POST RAW
$xml = '<action>perform</action>';
$response = $http->post('http:https://example.com/', $xml);
// HTTP PUT
$response = $http->put('http:https://example.com/', array('file'=>'/var/www/test.txt');

Build Status