<?php
// Function to make GET request to WordPress REST API
function get_posts($url) {
// Optional: Set headers if needed
'Content-Type: application/json',
'Authorization: Bearer YOUR_ACCESS_TOKEN' // For authenticated requests
]);
}
// Example usage
$posts = get_posts('https://j...content-available-to-author-only...s.systems/wp-json/wp/v2/posts');
?>
PD9waHAKCS8vIEZ1bmN0aW9uIHRvIG1ha2UgR0VUIHJlcXVlc3QgdG8gV29yZFByZXNzIFJFU1QgQVBJCmZ1bmN0aW9uIGdldF9wb3N0cygkdXJsKSB7CiAgICAkY2ggPSBjdXJsX2luaXQoKTsKCiAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfVVJMLCAkdXJsKTsKICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9SRVRVUk5UUkFOU0ZFUiwgdHJ1ZSk7CiAgICAKICAgIC8vIE9wdGlvbmFsOiBTZXQgaGVhZGVycyBpZiBuZWVkZWQKICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9IVFRQSEVBREVSLCBbCiAgICAgICAgJ0NvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbicsCiAgICAgICAgJ0F1dGhvcml6YXRpb246IEJlYXJlciBZT1VSX0FDQ0VTU19UT0tFTicgLy8gRm9yIGF1dGhlbnRpY2F0ZWQgcmVxdWVzdHMKICAgIF0pOwoKICAgICRyZXNwb25zZSA9IGN1cmxfZXhlYygkY2gpOwogICAgY3VybF9jbG9zZSgkY2gpOwoKICAgIHJldHVybiBqc29uX2RlY29kZSgkcmVzcG9uc2UsIHRydWUpOwp9CgovLyBFeGFtcGxlIHVzYWdlCiRwb3N0cyA9IGdldF9wb3N0cygnaHR0cHM6Ly9qLi4uY29udGVudC1hdmFpbGFibGUtdG8tYXV0aG9yLW9ubHkuLi5zLnN5c3RlbXMvd3AtanNvbi93cC92Mi9wb3N0cycpOwpwcmludF9yKCRwb3N0cyk7Cgo/PgoK