WordPress provided a lovely Json API with Jetpack.
I cannot seem to to find a way, or documentation on getting data from a multisite wordpress install?
It seems to fail on sites like www.example.com/site1. Any ideas?
WordPress provided a lovely Json API with Jetpack.
I cannot seem to to find a way, or documentation on getting data from a multisite wordpress install?
It seems to fail on sites like www.example.com/site1. Any ideas?
You must be logged in to post a comment.
I answered my own question.
The slash in the URL messes up the API call. However urlencoding the URL will get around it.
IE:
$context = stream_context_create( $options );
$site = urlencode("subdomain.example.com/site1");
$response = file_get_contents(
'https://public-api.wordpress.com/rest/v1/sites/' . $site .'/',
false,
$context
);