How do i use FQL with php api? and access token

后端 未结 1 866
情歌与酒
情歌与酒 2021-01-29 11:35

Grr... I cant seem to get fql working. One thing, I think the docs are old because i dont think api() likes just an array. Anyway:

$user_id = $facebook->get         


        
相关标签:
1条回答
  • 2021-01-29 12:27

    I use this:

    function fql($q, $access_token) {
        // Run fql query
        $fql_query_url = 'https://graph.facebook.com'
        . '/fql?q='. urlencode($q)
        . '&access_token=' . urlencode($access_token);
        $fql_query_result = file_get_contents($fql_query_url);
    
    
        $length = strlen(PHP_INT_MAX);
        $fql_query_result = preg_replace('/"(user_id)":(\d{' . $length . ',})/', '"\1":"\2"', $fql_query_result);
    
        return json_decode($fql_query_result, true);
    }
    
    0 讨论(0)
提交回复
热议问题