Download the PHP package initphp/curl without Composer
On this page you can find all versions of the php package initphp/curl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package curl
InitPHP Curl
Curl library to help you make advanced HTTP requests with PHP.
Requirements
- PHP 7.4 or higher
- PHP Curl Extension
Installation
Usage
This library can be used as HTTP client for your API service. Example:
Methods
client()
Creates a new client object.
getResponse()
Returns the result of the curl operation.
The values that can be used for the $key
parameter and its explanation are explained below.
NULL
: Returns an associative array containing all response information."status"
: Returns the status header information line of the HTTP response."code"
: Returns the HTTP response code."version"
: Returns HTTP response version information."headers"
: Returns the headers of the HTTP response as an array."body"
: Returns the body of the HTTP response.
setUrl()
Defines URL information for cURL.
Throws \InvalidArgumentException
if it is not a valid URL.
setHeader()
Adds a header for the request.
Example :
setHeaders()
For the request; Adds one or more headers via an associative array.
Example :
setMethod()
Defines the HTTP Request method.
The $method
parameter can take the following values;
- GET, POST, PUT, HEAD, DELETE, PATCH, OPTIONS
setBody()
HTTP Request is used to manually define the content information.
setVersion()
Defines the HTTP version of the HTTP request.
The $httpVersion
parameter can take the following values;
1.0
1.1
2.0
(libcurl v7.33 or higher version is required)
setUserAgent()
Defines the User Agent information to be reported to the server in the cURL process.
Example :
setReferer()
Defines HTTP referer information to be reported to the server.
setAllowRedirect()
Defines whether requests follow redirects. If this method is not used, the redirects are not followed.
setTimeout()
Defines the wait limit for the request in seconds or milliseconds.
If $isMicrosecond
is FALSE, the value is used as seconds.
setField()
Defines a data to be sent as POST.
setFields()
It defines the data to be sent by POST with an associative array.
setSSL()
Defines the SSL configurations of the cURL request.
setProxy()
Defines the proxy to be used by cURL.
setUpload()
It sends a file to be uploaded to the server.
Example (Single):
Example (Multi):
getInfo()
It is the curl_getinfo()
function in this library.
getError()
It is the curl_error()
function in this library.
setOpt()
It is the curl_setopt()
function in this library.
setOptions()
It is the curl_setopt_array()
function in this library.
handler()
cURL starts and executes.
save()
After cURL is handled, it writes the content to the specified file.
Returns the number of bytes written on success.
Example :
setCookie()
Defines a cookie to be sent with cURL.
Example :
setCookies()
Defines cookies as multiple with an associative array.
Example :
setCookieJarFile()
It tells the file path where the cookies values to be sent to the server will be kept or kept.
If the specified file exists, cookies are read from the file and sent to the server. CURLOPT_COOKIEFILE
If the specified file does not exist, cookies from the server are written to the file. CURLOPT_COOKIEJAR
Example :
Credits
License
Copyright © 2022 MIT License
All versions of curl with dependencies
ext-curl Version *