• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

help me connect to facbook?

Explorer ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

Can anyone help me, i want to display the news feeds from a facebook page, that is also mobile safe, i want to develop a mobile application..

How would this be done, could you show me some example code? or point me to t tutorial or something???

All the help will be greatly appreciated.

TOPICS
ActionScript

Views

5.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 08, 2011 Aug 08, 2011

This is how you'd start

var loader:URLLoader = new URLLoader(new URLRequest("https://graph.facebook.com/PAGE ID/feed?access_token=ACCESS TOKEN"));
            loader.addEventListener(Event.COMPLETE, loadComplete);
}
       
function loadComplete(e:Event):void {
            trace(e.target.data);
}

Votes

Translate

Translate
Community Expert ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

First thing is to note that Facebook is nightmare to develop with. Then you need to register your app to obtain the ID, to obtain the Access Token

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

Why a nightmare?

Legal complexity I guess.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

> Why a nightmare?

Poor documentation, unfriendly data format... they also have this habit of changing things without telling anyone

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

ok so once i have the ID then what?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

> ok so once i have the ID then what?

Request a token. Once you have it then call an API using URLLoader

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

can you please show me the code i would need to display the news feeds, mayby through arrays ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

This is how you'd start

var loader:URLLoader = new URLLoader(new URLRequest("https://graph.facebook.com/PAGE ID/feed?access_token=ACCESS TOKEN"));
            loader.addEventListener(Event.COMPLETE, loadComplete);
}
       
function loadComplete(e:Event):void {
            trace(e.target.data);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2011 Aug 11, 2011

Copy link to clipboard

Copied

in that code you provided above, i just refered back to it realised i somehow managed to change it completely.

So all i have to do is display that code, decode it intto json and then put it into a text field? which  thanks to the help of other people i understand now, but in that code where do i put my acess token????

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

So all i have to do is display that code, decode it intto json and then put it into a text field? which  thanks to the help of other people i understand now, but in that code where do i put my acess token????

Facebook returns the data in JSON so you will need to decode it using JSON class by Mike Chambers, just like the way I showed to you for Twitter.

Unlike Twitter, Facebook JSON data is Object so cast the decoded data to Object.

The other difference is that Facebook data is little more complex than Twitter data - there are Likes, comments, Likes to a comment, comments to a comment, etc - so the parsing is little more involved.

Access Token is needed when you call the API. I already showed it to you in my previous post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

kennethkawamoto2: Can you show me how to do this? I have really been trying so hard to find out how to do this, i have actually truly tried on my own before seeking help. All the tutorials on the internet show how to do login systems ect. I just want to display the news feeds from a fan page.. PLEASE HELP ME

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

Sure. I did tell you to get the ID and Token - have you got them? If you do not have them you can't get the feed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

yes i have a ID and token. Now what?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

Can you trace the JSON feed using the code above?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

i dont know, because i dont understand much about the code above ? i mean i get the url loader bit, then where do i put my id ect?

how do i call the feed from the API, if i know that then i can display it into a text field my self.

Can you show me how to decode it into JSON?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

There isn't much to it... Say the Page your accessing has the ID 12345678910, and the Access Token you obtained is 123456789123456|aBcDefgHiJKl_12a3C4DE5F6GH, your call to the API would be:

https://graph.facebook.com/12345678910/feed?access_token=123456789123456|aBcDefgHiJKl_12a3C4DE5F6GH

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

oooh so that would display the feeds of the page? ID is that meaning my id or the page ID?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

It's the Page ID, not your ID. Try it in the browser first - no need for Flash to test the URL.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

haha i figured it out literally 10 secs before i read this, but now its displaying this:

         "message": "Kissstory on the way to Eaton Sports Therapy sesh, yeeeeea. Brno MotoGP from Friday, nice little break :)",
         "type": "status",
         "application": {
            "name": "Facebook for iPhone",
            "id": "6628568379"
         },

well there is alot more than that but thats jsut a segmant. So how can i display just the news feeds from that?

so just what the API determines as "meassage:"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

That cannot be the whole data, it's just a segment as you said. Did you try it in the browser?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

no its not the whole data displayed, if yo want me to show you it all i can? but its basically the same as that. But i want to format it i guess so it only shows the message.. Instead of all that data... Do you know how to do this, i just want to display the "message:" instead of all the data, like twitter you only want to display the tweets..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

Ah sorry I misread your post - I thought that's all you received! So you received the JSON data, that's good

Then just decode it to an AS object. Facebook data object has "data" key, whcih holds an Array of wall posts. Once you get to that Array just iterate it to extract the messages.

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import com.adobe.serialization.json.JSON;

var loader:URLLoader = new URLLoader(new URLRequest("https://graph.facebook.com/XXX/feed?access_token=XXX"));
loader.addEventListener(Event.COMPLETE, loadComplete);

function loadComplete(e:Event):void {
    processData(e.target.data);
}

function processData(data:String):void {
    var facebookFeed:Array = JSON.decode(data).data as Array;
    for(var i:uint, feedCount:uint = facebookFeed.length; i < feedCount; i++){
        trace(facebookFeed.message);
    }
}

You should get a bunch of messages in trace.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

thanks for this, ima use this too!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!, THANK YOU!,

Dude you really helped me out man! I Appreciate it more than you can imagine! Thanks!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

Hold on you two are not the same person of course - you guys confused me

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines