0

グラフAPIを使用してFQLを実行しようとしています。

$graph_url = "https://graph.facebook.com/fql?q=".$fql."&access_token=". $access_token;

$output = json_decode(file_get_contents($graph_url));

var_dump($output);

これによりエラーが発生します

[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request

$graph_urlの内容をブラウザにコピーして貼り付けると、期待どおりの結果が得られます。したがって、access_tokenとfqlクエリは正しいと確信しています。

また、コンテンツを取得しようとすると

  $graph_url = "https://graph.facebook.com/me/?access_token=". $access_token;

  $output = json_decode(file_get_contents($graph_url));

  var_dump($output);

エラーは発生しませんが、期待どおりの結果が得られます。fqlクエリに何が欠けているのかわかりません。

4

1 に答える 1

0

私ができる最善の策は、urlencode の問題です。

これを試して、

$graph_url = "https://graph.facebook.com/fql?q=".urlencode($fql)."&access_token=". $access_token;
于 2012-06-12T17:19:57.350 に答える