Kotchasan

Curl
in package

Curl Class

Tags
see
https://www.kotchasan.com/

Table of Contents

$error  : int
Variable to store cURL errors 0 means no error (default value) Greater than 0 represents the cURL error number
$errorMessage  : string
Error message from cURL if there is an error in sending
$headers  : array<string|int, mixed>
HTTP headers
$options  : array<string|int, mixed>
CURLOPT parameters
__construct()  : mixed
Constructor
delete()  : string
DELETE
error()  : int
Returns the cURL error number 0 means no error
errorMessage()  : string
Returns the error message from cURL if there is an error in sending
get()  : string
GET
head()  : string
HEAD
httpauth()  : $this
HTTP authentication for sending requests
httpproxy()  : $this
Use PROXY
post()  : string
POST
put()  : string
PUT
referer()  : $this
Set referer
setCookie()  : $this
Set cookie file
setHeaders()  : $this
Set headers
setOptions()  : $this
Set options
execute()  : string
Execute cURL

Properties

$error

Variable to store cURL errors 0 means no error (default value) Greater than 0 represents the cURL error number

protected int $error = 0

$errorMessage

Error message from cURL if there is an error in sending

protected string $errorMessage = ''

$headers

HTTP headers

protected array<string|int, mixed> $headers = []

$options

CURLOPT parameters

protected array<string|int, mixed> $options = []

Methods

__construct()

Constructor

public __construct() : mixed
Tags
throws
Exception

If cURL is not supported

Return values
mixed

delete()

DELETE

public delete(string $url, mixed $params) : string
Parameters
$url : string
$params : mixed
Return values
string

error()

Returns the cURL error number 0 means no error

public error() : int
Return values
int

errorMessage()

Returns the error message from cURL if there is an error in sending

public errorMessage() : string
Return values
string

get()

GET

public get(string $url[, mixed $params = [] ]) : string
Parameters
$url : string
$params : mixed = []
Return values
string

head()

HEAD

public head(string $url[, mixed $params = [] ]) : string
Parameters
$url : string
$params : mixed = []
Return values
string

httpauth()

HTTP authentication for sending requests

public httpauth([string $username = '' ][, string $password = '' ][, string $type = 'any' ]) : $this
Parameters
$username : string = ''
$password : string = ''
$type : string = 'any'

any (default), digest, basic, digest_ie, negotiate, ntlm, ntlm_wb, anysafe, only

Return values
$this

httpproxy()

Use PROXY

public httpproxy([string $url = '' ][, int $port = 80 ][, string $username = null ][, string $password = null ]) : $this
Parameters
$url : string = ''
$port : int = 80
$username : string = null
$password : string = null
Return values
$this

post()

POST

public post(string $url[, mixed $params = [] ]) : string
Parameters
$url : string
$params : mixed = []
Return values
string

put()

PUT

public put(string $url[, mixed $params = [] ]) : string
Parameters
$url : string
$params : mixed = []
Return values
string

referer()

Set referer

public referer(string $referrer) : $this
Parameters
$referrer : string
Return values
$this

setCookie()

Set cookie file

public setCookie(string $cookiePath) : $this
Parameters
$cookiePath : string
Return values
$this

setHeaders()

Set headers

public setHeaders(array<string|int, mixed> $headers) : $this
Parameters
$headers : array<string|int, mixed>
Return values
$this

setOptions()

Set options

public setOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this

execute()

Execute cURL

protected execute(string $url) : string
Parameters
$url : string
Return values
string

Search results