Skip to content

Kirby 3.9.8

Remote

A handy little class to handle all kinds of remote requests

How to get a $remote object

<?php
$response = new Remote('https://example.com');

echo $response->code(); // e.g. 200
echo $response->url(); // https://example.com
echo $response->method(); // GET

dump($response->content());

Note that instantiating the object will fetch the data.

You can also get an object by calling the Remote::request()echo method or one of the shortcuts;

Shortcuts

Instead of using Remote::request() with the request method defined in the $params array, you can use the HTTP method names as method:

This works, because the Remote class implements the __callStatic magic method, which makes sure to execute not explicitely defined static methods.