Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import Facebook friends from another website

I am looking for a way to connect to Facebook by allowing the user to enter in their username and password and have our app connect to their account and get their contacts so that they can invite them to join their group on our site. I have written a Facebook app before, but this is not an app as much as it is a connector so that they can invite all their friends or just some to the site we are working on.

I have seen several other sites do this and also connect to Yahoo, Gmail and Hotmail contacts. I don't think they are using Facebook Connect to do this since it is so new, but they may be.

Any solution in any language is fine as I can port whatever example to use C#. I cannot find anything specifically on Google or Facebook to address this specific problem. Any help is appreciated.

I saw a first answer get removed that had suggested I might need to scrape the friends page. The more I look around, this might be what I need to do. Any other way I think will require the person to add it as an app. I am wondering how a answer can get removed, maybe that user deleted it.

like image 498
Jim Zimmerman Avatar asked Sep 17 '08 02:09

Jim Zimmerman


People also ask

How do I import friends into Facebook?

In the bottom right of Facebook, tap . Scroll down and tap Settings & Privacy, then tap Settings. Scroll down to the Permissions section and tap Upload Contacts. Tap next to Upload Contacts to turn this setting on or off.

Can I transfer my Facebook friends?

You'll need to manually add friends to your new account. Unfortunately, it is not possible to export your Facebook friends to a third-party account and then re-import them to a new Facebook account. However, you can import contacts from your smartphone.

How do I get my old Facebook friends back?

Click the "Add Friend" box next near the top of the person's Facebook Timeline to send her a friend request. The person is reinstated as a friend if she accepts your friend request.


3 Answers

Not answering the question but hopefully providing some insight...

It's features like this that teach people that it is ok to enter their username and password for site A on a form from site B. This is most definitely not ok. Please do not make people think it is.

But maybe the Facebook API allows you to circumvent this problem, by making people log into Facebook itself to give your app access. A slight but important difference.

like image 189
Thomas Avatar answered Oct 08 '22 05:10

Thomas


You can use Facebook Connect 'Account Linking'.

Python/Django example from Facebook developers wiki:

Page:

def invite_friends(request): 
    #HTML escape function for invitation content. 
    from cgi import escape 
    facebook_uid = request.facebook.uid 

    # Convert the array of friends into a comma-delimeted string. 
    exclude_ids = ",".join([str(a) for a in request.facebook.friends.getAppUsers()]) 

    # Prepare the invitation text that all invited users will receive. 
    content = """<fb:name uid="%s" firstnameonly="true" shownetwork="false"/>       wants to invite you to play Online board games, <fb:req-choice url="%s" label="Put Online Gaming and Video Chat on your profile!"/>""" % (facebook_uid, request.facebook.get_add_url()) 

    invitation_content = escape(content, True) 
    return render_to_response('facebook/invite_friends.fbml',
            {'content': invitation_content, 'exclude_ids': exclude_ids })

Template:

<fb:request-form action="http://apps.facebook.com/livevideochat/?skipped=1"     
        method="POST" invite="true" type="Online Games" 
        content="{{ content }}">        

    <fb:multi-friend-selector max="20" 
        actiontext="Here are your friends who aren't using Online Games and Live Video Chat. Invite them to play Games Online today!" 
        showborder="true" rows="5" exclude_ids="{{ exclude_ids }}"> </fb:request-form>
like image 30
Jon Hadley Avatar answered Oct 08 '22 04:10

Jon Hadley


I asked this question awhile ago and before facebook connect was live and well. The best way to really do this is using facebook connect.

http://developers.facebook.com/connect.php?tab=website

I am currently using this on our live site and using the Facebook Developer Toolkit for .NET on Codeplex here:

http://www.codeplex.com/FacebookToolkit

Good luck!

like image 40
Jim Zimmerman Avatar answered Oct 08 '22 05:10

Jim Zimmerman