Question

This bombs out:

$p = file_get_contents('https://graph.facebook.com/oauth/access_token');

With:

file_get_contents(https://graph.facebook.com/oauth/access_token): failed to open stream:
HTTP request failed! HTTP/1.1 400 Bad Request

Why?

I have OPENSSL enabled in Apache. I can see curl is on. What am I missing? I do have:

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(12) {
  [0]=>
  string(3) "php"
  [1]=>
  string(4) "file"
  [2]=>
  string(4) "glob"
  [3]=>
  string(4) "data"
  [4]=>
  string(4) "http"
  [5]=>
  string(3) "ftp"
  [6]=>
  string(3) "zip"
  [7]=>
  string(13) "compress.zlib"
  [8]=>
  string(14) "compress.bzip2"
  [9]=>
  string(5) "https"
  [10]=>
  string(4) "ftps"
  [11]=>
  string(4) "phar"
}
Was it helpful?

Solution

The problem turned out to be the settings in Facebook. I can access the HTTPs link, but Facebook returns a 400 error because I am not connecting from the right IP. facepalm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top