【发布时间】:2010-10-06 00:42:33
【问题描述】:
我正在尝试使用 cURL 进行 facebook 身份验证,这就是我所拥有的:
$url = "https://graph.facebook.com/oauth/access_token";
$postString = "?client_id=$client_id&redirect_uri=$redirect_uri&client_secret=$client_secret&code=$code";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FAILONERROR, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
$response = curl_exec($curl);
但每次它只返回 false。
我对使用 cURL 很陌生,所以我可能会犯一些初学者的错误,但我很困惑为什么这根本不起作用。
任何帮助将不胜感激!
【问题讨论】:
-
解决了,这是一个 ssl 问题,加上我的 $postString var 中的错字(开头的“?”)。