Curl
in package
Curl wrapper
Table of Contents
Constants
- TIMEOUT = 60
Properties
- $userAgent : string|null
- User agent
- $verbose : bool
- Verbose option
- $responseCode : mixed
- Response code
Methods
- delete() : mixed
- Run DELETE request.
- downloadFile() : bool
- Download file
- downloadFileInit() : object
- Init curl for file download
- get() : mixed
- Run GET request
- getFileContent() : mixed
- Get file content
- getResponseCode() : mixed
- Fet response code
- isInsatlled() : bool
- Return true if php curl extension is installed
- post() : mixed
- Run POST request
- put() : mixed
- Run PUT request
- request() : mixed
- Run curl request
- setData() : object
- Set post data
- create() : object|null
- Create curl
- exec() : mixed
- Run curl command
Constants
TIMEOUT
public
mixed
TIMEOUT
= 60
Properties
$userAgent
User agent
public
static string|null
$userAgent
= null
$verbose
Verbose option
public
static bool
$verbose
= false
$responseCode
Response code
private
static mixed
$responseCode
= null
Methods
delete()
Run DELETE request.
public
static delete(string $url[, array<string|int, mixed>|null $data = null ][, array<string|int, mixed>|null $headers = null ][, int $timeout = Self::TIMEOUT ]) : mixed
Parameters
- $url : string
- $data : array<string|int, mixed>|null = null
- $headers : array<string|int, mixed>|null = null
- $timeout : int = Self::TIMEOUT
downloadFile()
Download file
public
static downloadFile(string $url, string $fileName[, string|null $method = null ][, array<string|int, mixed>|null $headers = null ]) : bool
Parameters
- $url : string
- $fileName : string
- $method : string|null = null
- $headers : array<string|int, mixed>|null = null
Return values
booldownloadFileInit()
Init curl for file download
public
static downloadFileInit(object $curl[, string|null $method = null ][, array<string|int, mixed>|null $headers = null ]) : object
Parameters
- $curl : object
- $method : string|null = null
- $headers : array<string|int, mixed>|null = null
Return values
objectget()
Run GET request
public
static get(string $url[, array<string|int, mixed>|null $data = null ][, array<string|int, mixed>|null $headers = null ][, int $timeout = Self::TIMEOUT ]) : mixed
Parameters
- $url : string
- $data : array<string|int, mixed>|null = null
- $headers : array<string|int, mixed>|null = null
- $timeout : int = Self::TIMEOUT
getFileContent()
Get file content
public
static getFileContent(string $url[, string|null $method = null ][, array<string|int, mixed>|null $headers = null ]) : mixed
Parameters
- $url : string
- $method : string|null = null
- $headers : array<string|int, mixed>|null = null
getResponseCode()
Fet response code
public
static getResponseCode() : mixed
isInsatlled()
Return true if php curl extension is installed
public
static isInsatlled() : bool
Return values
boolpost()
Run POST request
public
static post(string $url[, array<string|int, mixed>|string|null $data = null ][, array<string|int, mixed>|null $headers = null ][, int $timeout = Self::TIMEOUT ]) : mixed
Parameters
- $url : string
- $data : array<string|int, mixed>|string|null = null
- $headers : array<string|int, mixed>|null = null
- $timeout : int = Self::TIMEOUT
put()
Run PUT request
public
static put(string $url[, array<string|int, mixed>|null $data = null ][, array<string|int, mixed>|null $headers = null ][, int $timeout = Self::TIMEOUT ]) : mixed
Parameters
- $url : string
- $data : array<string|int, mixed>|null = null
- $headers : array<string|int, mixed>|null = null
- $timeout : int = Self::TIMEOUT
request()
Run curl request
public
static request(string $url, string $method[, array<string|int, mixed>|string|null $data = null ][, array<string|int, mixed> $headers = null ][, int $timeout = Self::TIMEOUT ]) : mixed
Parameters
- $url : string
- $method : string
- $data : array<string|int, mixed>|string|null = null
- $headers : array<string|int, mixed> = null
- $timeout : int = Self::TIMEOUT
setData()
Set post data
public
static setData(object $curl, mixed $data[, string $method = 'POST' ]) : object
Parameters
- $curl : object
- $data : mixed
- $method : string = 'POST'
Return values
objectcreate()
Create curl
private
static create(string $url[, int $timeout = 30 ][, bool $returnTransfer = true ]) : object|null
Parameters
- $url : string
- $timeout : int = 30
- $returnTransfer : bool = true
Return values
object|nullexec()
Run curl command
private
static exec(object $curl) : mixed
Parameters
- $curl : object