# Remote

A handy little class to handle all kinds of remote requests

****

- Full class name: `Kirby\Http\Remote`
- Alias: `Remote`
- Source: <https://github.com/getkirby/kirby/tree/5.5.3/src/Http/Remote.php#L23>

****

### Remote

- [$remote->__call()](https://getkirby.com/docs/reference/objects/http/remote/__call.md)
- [Remote::__callStatic()](https://getkirby.com/docs/reference/objects/http/remote/__call-static.md)
- [new Remote()](https://getkirby.com/docs/reference/objects/http/remote/__construct.md)
- [$remote->code()](https://getkirby.com/docs/reference/objects/http/remote/code.md)
- [$remote->content()](https://getkirby.com/docs/reference/objects/http/remote/content.md)
- [$remote->fetch()](https://getkirby.com/docs/reference/objects/http/remote/fetch.md)
- [Remote::get()](https://getkirby.com/docs/reference/objects/http/remote/get.md)
- [$remote->headers()](https://getkirby.com/docs/reference/objects/http/remote/headers.md)
- [$remote->info()](https://getkirby.com/docs/reference/objects/http/remote/info.md)
- [$remote->json()](https://getkirby.com/docs/reference/objects/http/remote/json.md)
- [$remote->method()](https://getkirby.com/docs/reference/objects/http/remote/method.md)
- [$remote->options()](https://getkirby.com/docs/reference/objects/http/remote/options.md)
- [Remote::request()](https://getkirby.com/docs/reference/objects/http/remote/request.md)
- [$remote->url()](https://getkirby.com/docs/reference/objects/http/remote/url.md)

## How to get a `$remote` object

```php
<?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:

- `Remote::get()`, see <a href="https://getkirby.com/docs/reference/objects/http/remote/get">`$remote::get()`</a>
- `Remote::post()`
- `Remote::delete()`
- `Remote::patch()`
- `Remote::put()`
- `Remote::head()`

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