[wp-hackers] wp_remote_get() fails but wget works?

Mike Walsh mpwalsh8 at gmail.com
Mon Feb 4 13:41:34 UTC 2013

My WordPress Google Form plugin uses wp_remote_get() to retrieve the HTML
of a Google Form so in can be embedded into a WordPress site.  This has
worked great for a long time and my plugin has been pretty stable.

Last week Google introduced a significant update to Google Forms.  In
addition to a bunch of UI changes, the URL of the published form changed.

wp_remote_get() fails on any form created from scratch which has the new
URL format yet I am able to retrieve the form content without issue using
wget from the Unix command line.

I have been digging through the bowels of WP_Http trying to understand what
is happening and I am stumped.  Am hoping someone here can help me
interpret the response from Google and what I might be able to do about it.

wp_remote_get() returns the following:

    [0] => WP_Error Object
            [errors] => Array
                    [http_request_failed] => Array
                            [0] => Too many redirects.


            [error_data] => Array



I have captured a bunch of data and posted it on PasteBin:

   1. Complete wp_remote_get() Log
   2. wget Log
   3. wget Results

I am open to suggestions as right now I am out of ideas.  Increasing the
number of redirect tries didn't do anything other take it longer to fail.
 I am a bit worried that Google may be seeing my request as an XSS as this
appears in the wp_remote_get() log:

[x-xss-protection] => 1; mode=block

Thanks for looking at my problem.


Mike Walsh - mpwalsh8 at gmail.com

More information about the wp-hackers mailing list