2017 © Pedro Peláez
 

library php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

image

hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  • Tuesday, July 17, 2018
  • by hhxsv5
  • Repository
  • 2 Watchers
  • 9 Stars
  • 2,554 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 29 Versions
  • 3 % Grown

The README.md

Multiple cURL in PHP

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests., (*1)

Requirements

  • PHP 5.4 or later
  • PHP cURL extension

Installation via Composer(packagist)

composer require "hhxsv5/php-multi-curl:~1.0" -vvv

Usage

//require '../vendor/autoload.php';
use Hhxsv5\PhpMultiCurl\Curl;
use Hhxsv5\PhpMultiCurl\MultiCurl;

$getUrl = 'http://www.weather.com.cn/data/cityinfo/101270101.html';
$postUrl = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=yourtoken';

//Single http request
$options = [//The custom options of cURL
    CURLOPT_TIMEOUT        => 10,
    CURLOPT_CONNECTTIMEOUT => 5,
    CURLOPT_USERAGENT      => 'Multi-cURL client v1.5.0',
];

$c = new Curl(null, $options);
$c->makeGet($getUrl);
$response = $c->exec();
if ($response->hasError()) {
    //Fail
    var_dump($response->getError());
} else {
    //Success
    var_dump($response->getBody());
}

//Reuse $c
$c->makePost($postUrl);
$response = $c->exec();
if ($response->hasError()) {
    //Fail
    var_dump($response->getError());
} else {
    //Success
    var_dump($response->getBody());
}
//require '../vendor/autoload.php';
use Hhxsv5\PhpMultiCurl\Curl;
use Hhxsv5\PhpMultiCurl\MultiCurl;

$getUrl = 'http://www.weather.com.cn/data/cityinfo/101270101.html';
$postUrl = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=yourtoken';

//Multi http request
$c2 = new Curl();
$c2->makeGet($getUrl);

$c3 = new Curl();
$c3->makePost($postUrl);

$mc = new MultiCurl();

$mc->addCurls([$c2, $c3]);
$allSuccess = $mc->exec();
if ($allSuccess) {
    //All success
    var_dump($c2->getResponse()->getBody(), $c3->getResponse()->getBody());
} else {
    //Some curls failed
    var_dump($c2->getResponse()->getError(), $c3->getResponse()->getError());
}

echo PHP_EOL;

//Reuse $mc
$mc->reset();

$c4 = new Curl();
$c4->makeGet($getUrl);

$c5 = new Curl();
$c5->makePost($postUrl);

$mc->addCurls([$c4, $c5]);
$allSuccess = $mc->exec();
if ($allSuccess) {
    //All success
    var_dump($c4->getResponse()->getBody(), $c5->getResponse()->getBody());
} else {
    //Some curls failed
    var_dump($c4->getResponse()->getError(), $c5->getResponse()->getError());
}
//require '../vendor/autoload.php';
use Hhxsv5\PhpMultiCurl\Curl;

//Upload file
$postUrl = 'http://localhost/upload.php';//<?php var_dump($_FILES);
$options = [//The custom options of cURL
    CURLOPT_TIMEOUT        => 10,
    CURLOPT_CONNECTTIMEOUT => 5,
    CURLOPT_USERAGENT      => 'Multi-cURL client v1.5.0',
];
$c = new Curl(null, $options);
$file1 = new CURLFile('./olddriver.gif', 'image/gif', 'name1');
$params = ['file1' => $file1];
$c->makePost($postUrl, $params);
$response = $c->exec();
if ($response->hasError()) {
    //Fail
    var_dump($response->getError());
} else {
    //Success
    var_dump($response->getBody());
}
//require '../vendor/autoload.php';
use Hhxsv5\PhpMultiCurl\Curl;

$fileUrl = 'https://avatars2.githubusercontent.com/u/7278743?s=460&v=4';//<?php var_dump($_FILES);
$options = [//The custom options of cURL
    CURLOPT_TIMEOUT        => 3600,//1 hour
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_USERAGENT      => 'Multi-cURL client v1.5.0',
];
$c = new Curl(null, $options);
$c->makeGet($fileUrl);
$response = $c->exec();
if ($response->hasError()) {
    //Fail
    var_dump($response->getError());
} else {
    //Success
    $targetFile = './a/b/c/test.png';
    var_dump($c->responseToFile($targetFile));
}

License

MIT, (*2)

The Versions

17/07 2018

dev-master

9999999-dev https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl multi-curl parallel-request multi-http-request

17/07 2018

v1.5.8

1.5.8.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

05/07 2018

v1.5.7

1.5.7.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

04/07 2018

v1.5.6

1.5.6.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

04/07 2018

v1.5.5

1.5.5.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

03/07 2018

v1.5.4

1.5.4.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

03/07 2018

v1.5.3

1.5.3.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

02/07 2018

v1.5.1

1.5.1.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

02/07 2018

v1.5.0

1.5.0.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Xie Biao

curl multi-curl parallel-request multi-http-request

15/01 2018

v1.4.3

1.4.3.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library wrapping curl_multi_* is used to handle parallel http requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl multi-curl parallel-request multi-http-request

15/01 2018

v1.4.2

1.4.2.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

12/10 2017

v1.4.1

1.4.1.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

12/10 2017

v1.4.0

1.4.0.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

12/10 2017

v1.3.2

1.3.2.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

12/10 2017

v1.3.1

1.3.1.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

12/10 2017

v1.3.0

1.3.0.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

01/04 2017

v1.2.2

1.2.2.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

31/03 2017

v1.2.1

1.2.1.0 https://github.com/hhxsv5/php-multi-curl

A simple and efficient library for multi-curl is used to handle parallel requests.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

31/03 2017

v1.2.0

1.2.0.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

31/03 2017

v1.1.3

1.1.3.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

29/03 2017

v1.1.2

1.1.2.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

29/03 2017

v1.1.1

1.1.1.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

29/03 2017

v1.1.0

1.1.0.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

29/03 2017

v1.0.5

1.0.5.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

29/03 2017

v1.0.4

1.0.4.0 https://github.com/hhxsv5/php-multi-curl

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

28/03 2017

v1.0.3

1.0.3.0

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

28/03 2017

v1.0.2

1.0.2.0

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

28/03 2017

v1.0.1

1.0.1.0

A php wrapper class for multi-curl is used to handle parallel requests efficiently.

  Sources   Download

MIT

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl

28/03 2017

v1.0.0

1.0.0.0

Parallel curl http calls for PHP library.

  Sources   Download

MIT

The Development Requires

by Xie Biao

curl asynchronous parallel php-multi-curl