[wp-hackers] Possible bug with HTTP API using cookies
Dion Hulse (dd32)
wordpress at dd32.id.au
Tue Jul 31 04:00:59 UTC 2012
The Cookie field expects you to pass a WP_HTTP_Cookie instance, or
array of instances, not a set-header header.
The best bet is something like this:
$response = wp_remote_post(...);
$response2 = wp_remote_post( ..... 'cookie' => $response['cookies'] ) );
I haven't tested that, but that's the gist of what you should be doing.
On 31 July 2012 11:03, William P. Davis <will.davis at gmail.com> wrote:
> I'm using the HTTP api to get cookie information and then pass it through
> in another request. The code works fine on two servers but, as luck would
> have it, not on my production server. They all have CURL installed.
> The code is:
> $cookie = wp_remote_retrieve_headers( wp_remote_post( 'http://example.com'
> ) );
> $body = wp_remote_retrieve_body( wp_remote_post( 'http://example.com',
> array( 'body' => $args, 'cookies' => array( 'cookie' => $cookie[
> 'set-cookie' ] ) ) ) );
> And the error:
> Fatal error: Call to a member function getHeaderValue() on a non-object in
> /var/www/bangordailynews.com/htdocs/wp-includes/class-http.php on line 420
> I wanted to see if anybody else can replicate this disparity before I
> submit a bug report to trac.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers