← All built-ins / http_post()
http_post()
http_post(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $url | string | http:// URL |
| $body | string | request body |
| $headers | array | header lines like "Content-Type: application/json"optional |
Return value
Same map as http_get(), or false on failure.
Example
$r = http_post("http://localhost:1/unreachable", "a=1", ["Content-Type: application/x-www-form-urlencoded"]);
echo $r === false ? "offline-safe" : "unexpected";offline-safe