Menu

## Curl
in package

Curl.php : 18

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

Curl.php : 27

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

`protected int $error = 0`

#### $errorMessage

Curl.php : 33

Error message from cURL if there is an error in sending

`protected string $errorMessage = ''`

#### $headers

Curl.php : 39

HTTP headers

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

#### $options

Curl.php : 45

CURLOPT parameters

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

### Methods

#### __construct()

Curl.php : 52

Constructor

`public __construct() : mixed`

##### Tags

throws
  Exception

  If cURL is not supported

##### Return values

mixed —

#### delete()

Curl.php : 81

DELETE

`public delete(string $url, mixed $params) : string`

##### Parameters

$url : string
$params : mixed

##### Return values

string —

#### error()

Curl.php : 100

Returns the cURL error number 0 means no error

`public error() : int`

##### Return values

int —

#### errorMessage()

Curl.php : 110

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

`public errorMessage() : string`

##### Return values

string —

#### get()

Curl.php : 123

GET

`public get(string $url[, mixed $params = [] ]) : string`

##### Parameters

$url : string
$params : mixed = []

##### Return values

string —

#### head()

Curl.php : 145

HEAD

`public head(string $url[, mixed $params = [] ]) : string`

##### Parameters

$url : string
$params : mixed = []

##### Return values

string —

#### httpauth()

Curl.php : 168

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()

Curl.php : 185

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()

Curl.php : 203

POST

`public post(string $url[, mixed $params = [] ]) : string`

##### Parameters

$url : string
$params : mixed = []

##### Return values

string —

#### put()

Curl.php : 225

PUT

`public put(string $url[, mixed $params = [] ]) : string`

##### Parameters

$url : string
$params : mixed = []

##### Return values

string —

#### referer()

Curl.php : 245

Set referer

`public referer(string $referrer) : $this`

##### Parameters

$referrer : string

##### Return values

$this —

#### setCookie()

Curl.php : 258

Set cookie file

`public setCookie(string $cookiePath) : $this`

##### Parameters

$cookiePath : string

##### Return values

$this —

#### setHeaders()

Curl.php : 272

Set headers

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

##### Parameters

$headers : array<string|int, mixed>

##### Return values

$this —

#### setOptions()

Curl.php : 287

Set options

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

##### Parameters

$options : array<string|int, mixed>

##### Return values

$this —

#### execute()

Curl.php : 302

Execute cURL

`protected execute(string $url) : string`

##### Parameters

$url : string

##### Return values

string —

## Search results