Download the PHP package webiik/curlhttpclient without Composer
On this page you can find all versions of the php package webiik/curlhttpclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webiik/curlhttpclient
More information about webiik/curlhttpclient
Files in webiik/curlhttpclient
Package curlhttpclient
Short Description The CurlHttpClient allows to easily send HTTP request via curl.
License MIT
Homepage https://www.webiik.com
Informations about the package curlhttpclient
CurlHttpClient
The CurlHttpClient allows to easily send HTTP request via cURL.
Installation
Example
Summary
- Client
- Preparing Requests
- Processing Responses
CurlHttpClient
CurlHttpClient prepares cURL requests represented by CurlHttpClientReq, sends cURL requests and receives cURL responses represented by CurlHttpClientRes. It allows you to send asynchronously multiple requests at once.
prepareRequest
prepareRequest() creates object CurlHttpClientReq which represents set of cURL options.
send
send() sends cURL request using the options defined in CurlHttpClientReq, returns CurlHttpClientRes.
sendMulti
sendMulti() sends asynchronously multiple cURL requests at once. Once all requests are completed, it receives array of CurlHttpClientRes.
CurlHttpClientReq
CurlHttpClientReq represents set of cURL options. It provides many methods to easily add most common cURL options.
Connection settings
url
url() sets URL to connect to.
method
method() sets connection method e.g. GET, POST...
port
port() sets port to connect to.
followLocation
followLocation() sets to follow redirects.
auth
auth() sets authentication credentials.
proxy
proxy() set proxy to connect through.
verifySSL
verifySSL() sets to check SSL connection or not.
connectTimeout
connectTimeout() sets cURL connection timeout. 0 - wait indefinitely.
executionTimeout
executionTimeout() set cURL transfer timeout. 0 - never quit during transfer.
lowSpeedLimit
lowSpeedLimit() disconnects cURL if it's slower than $bytes/sec for $sec seconds.
Data To Send
userAgent
userAgent() sets user agent HTTP header.
referrer
referrer() sets referrer HTTP header.
header
header() sets HTTP header in format e.g. 'Content-type: image/jpeg'.
headers
headers() sets array of HTTP headers in format e.g. ['Content-type: image/jpeg',...]
mimicAjax
mimicAjax() sets HTTP header to mimic ajax.
cookie
cookie() sets 'Cookie' HTTP header.
cookieFile
cookieFile() sets cookie(s) from file.
cookieJar
cookieJar() catches response cookie(s) to file.
resetCookie
resetCookie() sets cURL to ignore all previous cookies.
postData
postData() adds post data to cURL request.
upload
upload() sets cURL to upload local file to remote server. $file is local file to be uploaded to remote server.
uploadSpeedLimit
uploadSpeedLimit() sets max upload speed in bytes per second.
Data To Receive
encoding
encoding() sets response encoding. Supported encodings are "identity", "deflate", and "gzip".
receiveBody
receiveBody() determines to receive response body or not.
receiveHeaders
receiveHeaders() determines to receive response headers or not.
receiveAsString
receiveAsString() sets cURL to return cURL response as a string instead of outputting it directly.
downloadToServer
downloadToServer() sets cURL to download remote file to local server. $file is used as a storage of remote file.
downloadToClient
downloadToClient() sets cURL to stream remote file to client.
downloadSpeedLimit
downloadSpeedLimit() sets max download speed in bytes per second.
Custom
verbose
verbose() sets cURL to receive verbose response info.
curlOption
curlOption() sets a cURL option.
curlOptions
curlOptions() sets an array of cURL options.
progressFile
progressFile() sets a file to store download/upload progress to. Progress is stored in JSON format.
progressJson
progressJson() sets cURL to print upload/download progress as a JSON (without content-type header).
CurlHttpClientRes
CurlHttpClientRes represents cURL response. It provides methods to easily access most common response informations.
header
header() gets response header by header name.
Parameters
- name header name
- sensitive determines if header name is case sensitive
- raw determines to return only header value(false) or complete header(true)
headers
headers() gets array of all response headers.
cookie
cookie() gets response cookie value by cookie name.
Parameters
- name cookie name
- sensitive determines if cookie name is case sensitive
- raw determines to return only cookie value(false) or complete cookie header(true)
cookies
cookies() gets array of all response cookie headers.
cookiesAssoc
cookiesAssoc() gets associative array of all response cookies.
body
body() gets response body.
size
size() gets response size in bytes.
mime
mime() gets response content type.
statusCode
statusCode() gets response HTTP status code.
errMessage
errMessage() gets cURL error message.
errNum
errNum() gets cURL error number.
isOk
isOk() indicates if cURL request was ok.
info
info() gets cURL info array.
requestHeaders
requestHeaders() gets array of all request headers.
requestCookies
requestCookies() gets array of all request cookie headers.