rakavai/curl-packs

There is no license information available for the latest version (1.0.0) of this package.

Curl wrapper object in php

1.0.0 2016-02-24 06:36 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:39 UTC


README

Curl wrapper in php. Multiple execution is also possible with CurlMulti in this repo.

##Composer composer require curl/curl

Quick Start and Examples

use CurlPacks\CurlOne;
$curl = new CurlOne("example.com");
$curl->execute(); //Default method is 'get'
$resposeBody = $curl->getBody();
$curl = new CurlOne("http://example.com");
$curl->setPostMethod();
$curl->setData(array(
  'name'=>'Rakibul Hasan'
));
$curl->setData('role',"Author");
$curl->execute();
$resposeBody = $curl->getBody();
$curl = new CurlOne("example.com");
$curl->execute();
$curl->setCookies("Key","Value");
$curl->setCookies("anotherKey=anotherWay");
$ccurl->setHeader("Cache-Control: max-age=0");
$resposeBody = $curl->getBody();
$resposeCookies=$curl->getCookiesWithKey() //Get all cookeis in array with key value

##For multi executable curl

$allCurl = array();
for ($index = 0; $index < 10; $index++) {
  $allCurl[] = new CurlOne("example.com")->setPostMethod();
}
$multiCurl = new CurlMulti($allCurl);
$multiCurl->executeAllCurlObject();
foreach ($multiCurl->getAllCurlOneObj() as $key => $aCurl) {
  echo $aCurl->getWholeData().'\n'; //any CurlOne method
}