class Curl (View source)

Constants

GET

HTTP method registry.

Lihat: https://www.iana.org/assignments/http-methods/http-methods.xhtml.

HEAD

POST

PUT

DELETE

CONNECT

OPTIONS

TRACE

BASELINE

LINK

UNLINK

MERGE

BASELINECONTROL

MKACTIVITY

VERSIONCONTROL

REPORT

CHECKOUT

CHECKIN

UNCHECKOUT

MKWORKSPACE

UPDATE

LABEL

ORDERPATCH

ACL

MKREDIRECTREF

UPDATEREDIRECTREF

MKCALENDAR

PROPFIND

LOCK

UNLOCK

PROPPATCH

MKCOL

COPY

MOVE

SEARCH

PATCH

BIND

UNBIND

REBIND

Methods

static array
json_options(bool $associative = false, int $depth = 512, int $options = 0)

Set mode json decode.

static bool
verify_peer(bool $enabled = true)

Verifikasi ssl peer.

static bool
verify_host(bool $enabled = true)

Verifikasi ssl host.

static int
timeout(int $seconds = 0)

Set request timeout (dalam detik).

static array
default_headers(array $headers)

Set default request header (batch).

static array
default_header(string $name, mixed $value)

Set default request header.

static array
clear_default_headers()

Hapus default request headers.

static array
curl_options(array $options)

Set curl option (batch).

static array
curl_option(string $name, mixed $value)

Set curl option.

static array
clear_curl_options()

Hapus curl options.

static string
cookie(string $cookie)

Set cookie (string).

static string
cookie_file(string $path)

Set cookie (file).

static void
auth(string $username = '', string $password = '', int $method = CURLAUTH_BASIC)

Set metode otentikasi request.

static void
proxy(string $address, int $port = 1080, int $type = CURLPROXY_HTTP, bool $tunnel = false)

Set proxy.

static void
proxy_auth(string $username = '', string $password = '', int $method = CURLAUTH_BASIC)

Set mode otentikasi proxy.

static stdClass
get(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan GET request.

static stdClass
head(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan HEAD request.

static stdClass
options(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan OPTIONS request.

static stdClass
connect(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan CONNECT request.

static stdClass
post(string $url, array $headers = [], mixed|null $body = null)

Jalankan POST request.

static stdClass
delete(string $url, array $headers = [], mixed|null $body = null)

Jalankan DELETE request.

static stdClass
put(string $url, array $headers = [], mixed|null $body = null)

Jalankan PUT request.

static stdClass
patch(string $url, array $headers = [], mixed|null $body = null)

Jalankan PATCH request.

static stdClass
trace(string $url, array $headers = [], mixed|null $body = null)

Jalankan TRACE request.

static stdClass
send(string $method, string $url, mixed|null $body = null, array $headers = [])

Jalankan curl request.

static string
body_file(string $path, string $alias = '')

Siapkan file untuk request body.

static string
body_json(mixed $data, int $json_options = 0)

Ubah deklarasi parameter menjadi string json.

static string
body_form(mixed $data)

Ubah deklarasi parameter menjadi string form-data.

static array
body_multipart(mixed $data, array $files = [])

Ubah deklarasi parameter menjadi string multipart form-data.

static array
build_curl_query(mixed $data, bool $parent = false)

Format query untuk request.

static array
info()

Ambil informasi transfer curl.

static CURLHandle|resource
handler()

Mereturn curl handler internal.

static array
format_headers(array $headers)

Format request headers.

static string
fake_user_agent()

Buat user-aget palsu.

Details

static array json_options(bool $associative = false, int $depth = 512, int $options = 0)

Set mode json decode.

Parameters

bool $associative
int $depth
int $options

Return Value

array

static bool verify_peer(bool $enabled = true)

Verifikasi ssl peer.

Parameters

bool $enabled

Return Value

bool

static bool verify_host(bool $enabled = true)

Verifikasi ssl host.

Parameters

bool $enabled

Return Value

bool

static int timeout(int $seconds = 0)

Set request timeout (dalam detik).

Parameters

int $seconds

Return Value

int

static array default_headers(array $headers)

Set default request header (batch).

Parameters

array $headers

Return Value

array

static array default_header(string $name, mixed $value)

Set default request header.

Parameters

string $name
mixed $value

Return Value

array

static array clear_default_headers()

Hapus default request headers.

Return Value

array

static array curl_options(array $options)

Set curl option (batch).

Parameters

array $options

Return Value

array

static array curl_option(string $name, mixed $value)

Set curl option.

Parameters

string $name
mixed $value

Return Value

array

static array clear_curl_options()

Hapus curl options.

Return Value

array

Set cookie (string).

Parameters

string $cookie

Return Value

string

Set cookie (file).

Parameters

string $path

Return Value

string

static void auth(string $username = '', string $password = '', int $method = CURLAUTH_BASIC)

Set metode otentikasi request.

Parameters

string $username
string $password
int $method

Return Value

void

static void proxy(string $address, int $port = 1080, int $type = CURLPROXY_HTTP, bool $tunnel = false)

Set proxy.

Parameters

string $address
int $port
int $type
bool $tunnel

Return Value

void

static void proxy_auth(string $username = '', string $password = '', int $method = CURLAUTH_BASIC)

Set mode otentikasi proxy.

Parameters

string $username
string $password
int $method

Return Value

void

static stdClass get(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan GET request.

Parameters

string $url
array $headers
mixed|null $parameters

Return Value

stdClass

static stdClass head(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan HEAD request.

Parameters

string $url
array $headers
mixed|null $parameters

Return Value

stdClass

static stdClass options(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan OPTIONS request.

Parameters

string $url
array $headers
mixed|null $parameters

Return Value

stdClass

static stdClass connect(string $url, array $headers = [], mixed|null $parameters = null)

Jalankan CONNECT request.

Parameters

string $url
array $headers
mixed|null $parameters

Return Value

stdClass

static stdClass post(string $url, array $headers = [], mixed|null $body = null)

Jalankan POST request.

Parameters

string $url
array $headers
mixed|null $body

Return Value

stdClass

static stdClass delete(string $url, array $headers = [], mixed|null $body = null)

Jalankan DELETE request.

Parameters

string $url
array $headers
mixed|null $body

Return Value

stdClass

static stdClass put(string $url, array $headers = [], mixed|null $body = null)

Jalankan PUT request.

Parameters

string $url
array $headers
mixed|null $body

Return Value

stdClass

static stdClass patch(string $url, array $headers = [], mixed|null $body = null)

Jalankan PATCH request.

Parameters

string $url
array $headers
mixed|null $body

Return Value

stdClass

static stdClass trace(string $url, array $headers = [], mixed|null $body = null)

Jalankan TRACE request.

Parameters

string $url
array $headers
mixed|null $body

Return Value

stdClass

static stdClass send(string $method, string $url, mixed|null $body = null, array $headers = [])

Jalankan curl request.

Parameters

string $method
string $url
mixed|null $body
array $headers

Return Value

stdClass

static string body_file(string $path, string $alias = '')

Siapkan file untuk request body.

Untuk digunakan di dalam deklarasi parameter request.

Parameters

string $path
string $alias

Return Value

string

static string body_json(mixed $data, int $json_options = 0)

Ubah deklarasi parameter menjadi string json.

Parameters

mixed $data
int $json_options

Return Value

string

static string body_form(mixed $data)

Ubah deklarasi parameter menjadi string form-data.

Parameters

mixed $data

Return Value

string

static array body_multipart(mixed $data, array $files = [])

Ubah deklarasi parameter menjadi string multipart form-data.

Parameters

mixed $data
array $files

Return Value

array

static array build_curl_query(mixed $data, bool $parent = false)

Format query untuk request.

Parameters

mixed $data
bool $parent

Return Value

array

static array info()

Ambil informasi transfer curl.

Return Value

array

static CURLHandle|resource handler()

Mereturn curl handler internal.

Return Value

CURLHandle|resource

static array format_headers(array $headers)

Format request headers.

Parameters

array $headers

Return Value

array

static string fake_user_agent()

Buat user-aget palsu.

Return Value

string