【发布时间】:2014-11-06 20:59:57
【问题描述】:
我不理解 Facebook 文档(找到 here)中 GET 请求的这种表示法:
GET /oauth/access_token?
client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
这在 apache 术语中是什么意思以及如何在 php 中编写这样的请求?我发现file_get_contents 和http_get 都需要一个网址。语法如下:
$response = http_get("http://www.example.com/", array("timeout"=>1), $info);
$homepage = file_get_contents('http://www.example.com/')
我可以使用其中一个或两个功能吗?我该怎么写?我正在寻找关于此的良好文档的时间。
【问题讨论】:
-
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') -
@Marc B:感谢您容忍初学者的问题!在网上找不到任何关于此的内容。希望这对将来的其他初学者有所帮助。
-
你输入你的客户端ip/secret了吗?还是您确实使用了
{app-id}和{app-secret}? -
成功了!谢谢你。请张贴作为答案,我会接受。
标签: php facebook facebook-graph-api get-request