You can pass URL into
file_get_contents to download content with HTTP GET request:
$page = file_get_contents('https://google.com');
However, you can do much more. You can make any type of HTTP requests, add custom request headers as well as request body. A complete example of HTTP POST request with
$options = [ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\n" . "User-Agent: Badass Bot", 'content' => http_build_query ([ 'name' => 'Sam', 'age' => 25 ]) ] ]; $context = stream_context_create($options); $result = file_get_contents('https://samblog.com/form', false, $context);
You can replace
method value with
DELETE, or any other type of HTTP request which you need to send.