I've got a plugin that needs to interogate the post preview (the contents of the rendered page that's presented when the user clicks "Preview Post".
To attempt to obtain this input stream into a code variable, I'm using wp_remote_get like so:
$response = wp_remote_retrieve_body( wp_remote_get( 'http://localhost/mysite/test-post/?preview=true&preview_id=28&preview_nonce=640bc54ca4')); $post->post_content = $response;
(I'm just replacing the post content with the results of the get for easy previewing during code testing).
My problem is that since I'm not passing any authentication parameters in the wp_remote_get, the preview action fails.
Is it possible to pass a parameter that authenticates the current user and returns the preview to the script?