Curl
in package
Class Curl
Wrapper for the PHP Curl class.
Curl constants
13 CURLOPT_TIMEOUT 47 CURLOPT_POST 52 CURLOPT_FOLLOWLOCATION 64 CURLOPT_SSL_VERIFYPEER 78 CURLOPT_CONNECTTIMEOUT 80 CURLOPT_HTTPGET 10001 CURLOPT_FILE 10002 CURLOPT_URL 10005 CURLOPT_USERPWD 10015 CURLOPT_POSTFIELDS 10022 CURLOPT_COOKIE 19913 CURLOPT_RETURNTRANSFER
Table of Contents
- $curlStatus : int
- Curl status code.
- $errorMsg : string
- Curl error message.
- $httpStatus : int
- HTTP request status code.
- $options : array<string|int, mixed>
- Request options.
- $type : string
- Result content-type.
- $url : string
- Request URL.
- $logger : MonologWrapper
- __construct() : mixed
- get() : string
- Send a GET request using cURL.
- post() : string
- Send a POST request using cURL.
- exec() : string
- Perform a cURL request.
- getCurlOptions() : array<string|int, mixed>
- Utility function to get options after adding them to the default curl options.
Properties
$curlStatus
Curl status code.
public
int
$curlStatus
Curl result status code.
$errorMsg
Curl error message.
public
string
$errorMsg
Curl result error message.
$httpStatus
HTTP request status code.
public
int
$httpStatus
Curl result HTTP status code.
$options
Request options.
public
array<string|int, mixed>
$options
= [CURLOPT_RETURNTRANSFER => true]
Request options.
$type
Result content-type.
public
string
$type
Curl result content-type.
$url
Request URL.
public
string
$url
Request URL.
$logger
protected
MonologWrapper
$logger
Logger.
Methods
__construct()
public
__construct(MonologWrapper $logger) : mixed
Parameters
- $logger : MonologWrapper
-
The logger.
Return values
mixed —get()
Send a GET request using cURL.
public
get(string $url[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $url : string
-
Url for the curl call.
- $options : array<string|int, mixed> = []
-
Additional options.
Tags
Return values
string —post()
Send a POST request using cURL.
public
post(string $url[, array<string|int, mixed> $options = array() ]) : string
Parameters
- $url : string
-
Url for the curl call.
- $options : array<string|int, mixed> = array()
-
Additional options. This includes the post vars.
Tags
Return values
string —exec()
Perform a cURL request.
private
exec(string $url[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $url : string
-
Url for the curl call.
- $options : array<string|int, mixed> = []
-
Additional options.
Tags
Return values
string —getCurlOptions()
Utility function to get options after adding them to the default curl options.
private
getCurlOptions(string $url[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $url : string
-
Url for the curl call.
- $options : array<string|int, mixed> = []
-
Additional options.
Return values
array<string|int, mixed> —Array of options