Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remote WordPress API REST request
$uri = '';
$json = file_get_contents($uri);
$posts= json_decode($json);
echo "<h1>Listado de entradas</h1><ul>";
foreach ($posts as $post) {
echo "<h2><a href='" . $post->link . "'>" . $post->title->rendered . "</a></h2>\n";
echo "<p>" . $post->excerpt->rendered . "</p>";
echo "<p><a href='" . $post->link . "'>Enlace directo</a></p>\n";
echo "</ul>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment