← All built-ins / http_get()

http_get()

http_get(string $s): mixed

Parameters

NameTypeDescription
$urlstringhttp:// URL (TLS is not supported)

Return value

["status" => 200, "body" => …, "contentType" => …] on success, false on failure.

Example

$r = http_get("http://localhost:1/unreachable");
echo $r === false ? "offline-safe" : "unexpected";
offline-safe

See also

http_post()http_request()parse_url()