English 中文(简体)
列出所有核准贵方申请表的朋友
原标题:List all friends who approved your FB application request

我需要展示我赞同我的申请的朋友的名字。 我正在利用这一守则向我的朋友发出要求,

FB.getLoginStatus(function(response) {
    if (response.authResponse) {     
        FB.ui({
            method:  apprequests ,
            message:  Hey guys check this out 
        });
    } 
});

I tried searching answers from other forum but doesn t found any. Please help.

提前感谢。

最佳回答

When your app is proccessing the requests when the recipients accept them, you ll need to save that in your own database, there s no way to subsequently query the API for that information

问题回答

Assuming you have instantiated the facebook class (here, "$Fb"), and given your id and secret... "$user" is facebook "user_id" (ie 12345678...) of the user of which we want the list of friends

$access_token = $Fb->getAccessToken();
$user_profile = $Fb->api( /me );
// show user image
$txt .= "<p align="center">
            <img src="https://graph.facebook.com/".$user."/picture"></p>";
$FBid = $user_profile[ id ];
$FBnick = $user_profile[ username ];
$txt .= fb_friends_list($user_profile,$access_token);
echo ($txt);

上文提到以下职能:获得朋友名单:

function fb_friends_list($fbup,$access_token)
{
    // display the friends list on 3 columns, with their avatar.
    global $Sess,$Fb;
    $friends = $Fb->api( /me/friends ); // return an array [data][0 to n][name]/[id]
    $siz = sizeof($friends[ data ]);
    $txt  = "<h3 align="center">Your FRIENDS on FACEBOOK</h3>";
    $txt .= "<table align="center">
                <tr>
                    <td class="blu s12 bld">Friend s<br />Avatar</td>
                    <td class="blu s12 bld">Friend s Name</td>
                    <td width="30px">&nbsp;</td>
                    <td class="blu s12 bld">Friend s<br />Avatar</td>
                    <td class="blu s12 bld">Friend s Name</td>
                    <td width="30px">&nbsp;</td>
                    <td class="blu s12 bld">Friend s<br />Avatar</td>
                    <td class="blu s12 bld">Friend s Name</td>
                </tr>";
    $col = 0;
    for ($i=0; $i<$siz; $i++)
    {
        $fid = $friends[ data ][$i][ id ];
        $src = "http://graph.facebook.com/".$fid."/picture";
        if ($col == 0)
            $txt .= "<tr>";
        $txt .= "<td><img src="".$src."" /></td>";
        $txt .= "<td>".$friends[ data ][$i][ name ] . "</td>";
        $txt .= "<input type="hidden" name="".$fid."" />";
        $col++;
        if ($col < 3)
            $txt .= "<td width="30px">&nbsp;</td>";
        if ($col == 3)
        {
            $col = 0;
            $txt .= "</tr>";
        }
    }
    if ($col != 0)
        $txt .= "</tr>";
    $txt .= "</table>";
    return($txt);
}

希望能为你们工作!





相关问题
PHP SoapClient request

I m trying to send a SOAP request to a newsletter service using this WSDL. Here s my PHP: $client = new SoapClient($wsdl_url, array( login => myusername , password => mypassword ,...

twitpic API not connecting (multipart/form-data) objective-c

I ve put together this code from lots of research. Information on the twitpic API is here: http://twitpic.com/api.do#uploadAndPost Through debugging i can tell that the dictionary is good, and ...

Rails - RESTful Routing - Add a POST for Member i.e(tips/6)

I m trying to create some nice RESTful structure for my app in rails but now I m stuck on a conception that unfortunately I m not sure if its correct, but if someone could help me on this it would be ...

grails + gwt request handling via controllers

I am new to gwt. I am trying to integrate gwt+grails.Can anybody provide me a good example for handling the request using grails controllers and not a custom servlet.I will be really thankful if ...

add text in http request string url

ok i made a midlet through which i can connect to server pages and get soem information as response. For example i made a midlet through which i acced url: http://example.com/?u=nepal&t=1 Now i ...

How to find if a request is for js or css in httpHandler

is there any way to find if a particular request is for JS or CSS in httphandler to improve the performance of my website i was using HttpCompress from Code Project http://www.codeproject.com/KB/...

How do I grab all the request parameters in Catalyst?

Specifically I m trying to capture all the POST parameters from a payment gateway as a single string, and then parse them looking for the string ERROR . I m aware that there s a $c->request->...

Fire off an internal ServletRequest in Tomcat

I am using Quartz to schedule background tasks for a web application. Some of these tasks just fire off requests against the same web application. I want to avoid depending on any kind of network ...

热门标签