Download the PHP package aalfiann/parallel-request-php without Composer
On this page you can find all versions of the php package aalfiann/parallel-request-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package parallel-request-php
ParallelRequest PHP
A PHP class to create multiple request in parallel (non blocking).
Installation
Install this package via Composer.
Usage send GET request
This will send GET request silently without response output.
If you want to see the response
Usage send POST request
Usage send for custom request
If you want to send custom request like PUT, PATCH, DELETE, etc.
Just add the CURLOPT_CUSTOMREQUEST => 'PUT'
.
Chain Usage
You also able to make chain.
How to debug
To send a request absolutely we need to know what happened in our request
Difference setRequest() and addRequest() and addRequestRaw()
This three functions are required to build the request.
setRequest()
is need you to create the string / formatted array first before use this.
Example:
addRequest()
is you can create string / formatted array on the fly
Example:
addRequestRaw()
is you can create raw data to send through request
Example:
Function List
- setRequest($request) is to create the request url (string or array with post data).
- addRequest($url,$params=array(),$formdata=true) is to create the request url (string or array with params data).
- addRequestRaw($url,$data) is to create the request url with raw data formatted. Parameter data is not encoded by default.
- setOptions($options=array()) is to set the options of CURLOPT.
- setHttpStatusOnly($httpStatusOnly=false) if set to true then output response will converted to http status code.
- setHttpInfo($httpInfo=false) if set to true then output response will display the http info status. Set to "detail" for more info.
- setDelayTime($time=10000) is the delay execution time for cpu to take a rest. Default is 10000 (10ms) in microseconds.
- setEncoded($encoded=true) is to encode the data post. The default data post is not encoded so you can create more complex data request.
- send() is curl are sending the request (silently without any output)
- getResponse() is to get the output response (the return data could be string or array).
- getResponseJson() is to get the output response with json formatted.
Note:
- If you only create single request, response will return string.
- This class basically using
curl_multi_exec()
function. - If you not specify
$req->options
then it will be use[CURLOPT_HEADER => false,CURLOPT_RETURNTRANSFER => true]
as default.