file_get_contents()在facebook api上播放

Evo*_*Evo 5 php facebook

file_get_contents() [function.file-get-contents]: SSL: Connection reset by peer in 
Run Code Online (Sandbox Code Playgroud)

file_get_contents("https://api.facebook.com/method/events.invite?eid=" .  $eid . "&uids=" . json_encode($uids) . "&access_token=" . $facebook->getAccessToken())
Run Code Online (Sandbox Code Playgroud)

它邀请他们选择参加活动的用户朋友,however我在这篇文章的顶部收到错误.经过测试cURL,同样的错误.

TESTED

我回去用cURL测试了一些东西

$url = "https://api.facebook.com/method/events.invite?eid=157437064317827&uids=" . json_encode($uids) . "&access_token=" . $facebook->getAccessToken();

$url2 = urlencode($url);
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
curl_setopt($ch, CURLOPT_URL, $url2); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$data = curl_exec($ch) or die(curl_error($ch));
curl_close($ch);`
Run Code Online (Sandbox Code Playgroud)

得到错误:无法解析主机'https%3A%2F%2Fapi.facebook.com ...

小智 2

您是否尝试过使用 Graph API,而不是已弃用的 API?

您可以改为调用:

$event_id = "EVENT_ID";
$user_ids = "ID1,ID2,ID3"; // this can be populated however, but that's the syntax
$graph_url = "https://graph.facebook.com/{$event_id}/invited/{$user_ids}";
$graph_contents = file_get_contents($graph_url);
$data = json_decode($graph_contents);
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助。:)