阵列翻译的FQL API问题? [英] FQL API issues with array translation?

查看:127
本文介绍了阵列翻译的FQL API问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道有没有人遇到这个问题,我似乎无法解决它 - 哈哈。

Just wanted to know if anyone has come across this issues, I can't seem to fix it - lol.

使用Facebook fql获取所有用户的朋友的数据,它加载了90%的UID正确,然后加载其他人,如 http://fb.com/1.0000411781126 E + 14

Using Facebook fql to get all user friends data, it loads 90% of the UID's correct and then loads the others like this " http://fb.com/1.0000411781126E+14 "

它缩放了UID ...但是我并没有告诉所有这些。

It's scaling the UID ... but I am not telling it to all all.

代码:

  // run fql query
  $fql_query_url = 'https://graph.facebook.com/'
    . 'fql?q=SELECT%20uid%2Cfirst_name%2Clast_name%2Cname%2Cemail%2Ccurrent_location%2Cbirthday_date%2C%20contact_email%2Cusername%20FROM%20user%20WHERE%20uid%20IN%20(SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me())%0A'
    . '&access_token=' . $access_token;
  $fql_query_result = file_get_contents($fql_query_url);
  $fql_query_obj = json_decode($fql_query_result, true);

  // display results of fql query
 // echo '<pre>';
  //print_r("query results:");
  //print_r($fql_query_obj);
  //echo '</pre>';

?>

<table class="dynamicTable colVis table table-striped table-bordered table-condensed table-white">
        <thead>
        <tr>
            <th>Image</th>  
            <th>Full Name</th> 
            <th>Gender</th>
            <th>Locale</th>
            <th>FB Email</th>
            <th>Location</th>
            <!-- <th>Job</th> -->
            <th>Subscribers</th>
            <th>SubscribedTo</th>
            <th>Groups</th>
            <th>Posts</th>
         </tr>
        </thead>

        <?php
         $loopvar = 1;
        foreach ($fql_query_obj['data'] as $eachfriend) {
            $id       = $eachfriend['uid'];
            $name     = $eachfriend['name'];
            $username = $eachfriend['username'];

            //if(array_key_exists('work', $eachfriend)){
            //  $current_work = $eachfriend['work'][0]['employer']['name'];
            //}
            // else
            //  $current_work = "<span style='color:red;'>None</span>";



        echo "<tr>";
        echo "<td><a target='_blank' href='http://fb.com/".$id."'><img src='http://graph.facebook.com/" . $id . "/picture'/></a></td>";
        // echo "<td><a target='_blank' href='http://fb.com/".$id."'>" . $id . "</a></td>";
        echo "<td>" . $name . "</td>";


推荐答案

尝试这个

$fql_query_obj = json_decode(preg_replace('/"uid":(\d+)/', '"uid":"$1"', $fql_query_result),true);

在同一个问题上回答

如何处理FQL返回的大型int ui uid?

这篇关于阵列翻译的FQL API问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆