我不理解Facebook文档中GET请求的这种表示法(可在此处找到):
GET /oauth/access_token?
client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
这在apache术语中意味着什么?我如何在php中编写这样的请求?我找到了需要url的file_get_contents
和http_get
。语法如下:
$response = http_get("http://www.example.com/", array("timeout"=>1), $info);
$homepage = file_get_contents('http://www.example.com/')
我可以使用这两个函数中的一个或两个吗?我该怎么写?我很难找到关于这方面的好文档。
来自@Marc B:
GET/foo就是实际http请求的外观,如果您有http://example.com/foo.为了易读,他们还把它分成了多行,仅此而已。
这起到了作用:
file_get_contents('https://graph.facebook.com/oauth/access_token?client_id={app-id}&client_secret={app-secret}&grant_type=client_credentials')
请记住删除应用程序id和应用程序机密中的大括号。