Skip to content

Kirby 5.0.4

$remote->code()

Returns the http status code

$remote->code(): int|null

Return types

intornull

This method modifies the existing $remote object it is applied to and returns it again.

Parent class

Kirby\Http\Remote

Examples

<?php
$response = Remote::get('https://picsum.photos/200/300');

// Do stuff depending on http code
// Codes and how you want to handle them depends on the API you are querying
if ($response->code() === 200) {
    // do something if the request is successful
}