Curl
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
Set mode json decode.
Verifikasi ssl peer.
Verifikasi ssl host.
Set request timeout (dalam detik).
Set default request header (batch).
Set default request header.
Hapus default request headers.
Set curl option (batch).
Set curl option.
Hapus curl options.
Set cookie (string).
Set cookie (file).
Set metode otentikasi request.
Set proxy.
Set mode otentikasi proxy.
Jalankan GET request.
Jalankan HEAD request.
Jalankan OPTIONS request.
Jalankan CONNECT request.
Jalankan POST request.
Jalankan DELETE request.
Jalankan PUT request.
Jalankan PATCH request.
Jalankan TRACE request.
Jalankan curl request.
Siapkan file untuk request body.
Ubah deklarasi parameter menjadi string json.
Ubah deklarasi parameter menjadi string form-data.
Ubah deklarasi parameter menjadi string multipart form-data.
Format query untuk request.
Ambil informasi transfer curl.
Mereturn curl handler internal.
Format request headers.
Buat user-aget palsu.
Details
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.
Untuk digunakan di dalam deklarasi parameter request.
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.