failed to open stream: HTTP request failed!

  • 2
  • Problem
  • Updated 8 years ago
When i run the PHP sample code from my local environment iam getting this error as follows

failed to open stream: HTTP request failed!.

if i run the URL directly , getting the jason and xml format outputs, but not from the file_get_contents().

Can some one tell me what might be the problem? Iam using this API for the first time
Photo of lionking123


  • 1 Post
  • 0 Reply Likes

Posted 8 years ago

  • 2
Photo of afelicioni


  • 227 Posts
  • 43 Reply Likes
some quick checks you can perform:

  • allow_url_fopen must be on in php.ini

  • you may need to use urlencode() in referencing the URL API call