0

I'm trying to get an image from Google but...

wp_remote_get returns me:

Could not open handle for fopen() to 
https://ajax.googleapis.com/ajax/services/search/images?
v=1.0&q=whatever.whatever&key=MYKEYWHICHIDONTPOST&userip=127.0.0"

I don't know why:

  • when I enter the url directly I do get results.
  • all other wp_remote_gets in the same class work ok so yes php.ini allow=ok

this is the code i run:

$referer_url = get_bloginfo('url');
$referer = $parsed_url[host];                   
$google_images_url = self::GOOGLE_IMAGES_URL . "&q=" .  $url_to_look_for . "&key=" . $key . "&userip="  . $_SERVER['REMOTE_ADDR'];
$response = wp_remote_get($google_images_url, array( 'headers' => array( 'Referer' => $referer)));

hmmm

  • ah... it is the https ... doesnt like that – edelwater Feb 8 '11 at 2:05
3

Yep, I experienced that under some network configurations https links fail (my case was behind proxy server).

You can use Core Control plugin to test available HTTP transports and disable glitchy one. In my case bumping transport to curl solved issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.