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.
Package curl
Short Description Curl Library (DEPRECATED — use initphp/http:^2.2 for HTTP requests)
License MIT
Informations about the package curl
InitPHP Curl
⚠️ DEPRECATED — Use
initphp/httpinsteadAs part of the InitPHP package consolidation, this package has been retired in favor of
initphp/httpstarting with version 2.2. The consolidated package ships a PSR-18 HTTP client (\InitPHP\HTTP\Client\Client) that callsext-curldirectly and is the supported way to issue HTTP requests in the InitPHP ecosystem.This repository is kept read-only for historical reference. No further updates will be released.
Migration
There is no drop-in replacement for
\InitPHP\Curl\Curl— the canonical client speaks PSR-7 / PSR-18 rather than exposing a thin cURL builder. Two paths exist:
You used this package to issue HTTP requests. Move to the canonical PSR-18 client:
- You used this package for non-HTTP cURL operations (FTP, SMTP, file uploads to custom endpoints, etc.). A thin wrapper around the cURL extension does not warrant its own package — call
curl_init()/curl_setopt()/curl_exec()directly, or pull in a more capable library (e.g.guzzlehttp/guzzle,symfony/http-client).Composer declares a
replacefrominitphp/http:^2.2to this package, so the two will not be installed side-by-side once you depend on the consolidated package.
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.01.12.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 *