static function wpcom_json_api_request_as_blog($path, $version = self::WPCOM_JSON_API_VERSION, $args = array(), $body = null)
{
$filtered_args = array_intersect_key($args, array('method' => 'string', 'timeout' => 'int', 'redirection' => 'int', 'stream' => 'boolean', 'filename' => 'string'));
/**
* Determines whether Jetpack can send outbound https requests to the WPCOM api.
*
* @since 3.6.0
*
* @param bool $proto Defaults to true.
*/
$proto = apply_filters('jetpack_can_make_outbound_https', true) ? 'https' : 'http';
// unprecedingslashit
$_path = preg_replace('/^\\//', '', $path);
// Use GET by default whereas `remote_request` uses POST
if (isset($filtered_args['method']) && strtoupper($filtered_args['method'] === 'POST')) {
$request_method = 'POST';
} else {
$request_method = 'GET';
}
$validated_args = array_merge($filtered_args, array('url' => sprintf('%s://%s/rest/v%s/%s', $proto, JETPACK__WPCOM_JSON_API_HOST, $version, $_path), 'blog_id' => (int) Jetpack_Options::get_option('id'), 'method' => $request_method));
return Jetpack_Client::remote_request($validated_args, $body);
}