开发者

How to access Facebook Fan Page Photos within external Website

We are trying to utilize the facebook photo hosting and allow our visitors to view photos via our webpage that have bee开发者_高级运维n uploaded to our fan wall.

Does anyone know how this can be achieved?

Thank in advance! Steven.


Using the social graph, you can do this, provided the script has an access token for your facebook page app ID or your photo permissions are set to be completely public.

Using the social graph, you basically access the photos via a REST like web service. The webservice call will return a JSON object of dataExample:

https://graph.facebook.com/cocacola/albums

(Photo albums for the Coca Cola fan page)

So the first step would be to retrieve the albums using a URL like the one above. Traverse through the photo albums and get the object ID of the album you want.

{
         "id": "455377148305",
         "from": {
            "name": "Coca-Cola",
            "category": "Company",
            "id": "40796308305"
         },
         "name": "Coca-Cola Fanmeile FIFA WM 2010",
         "link": "http://www.facebook.com/album.php?aid=249745&id=40796308305",
         "count": 20,
         "type": "normal",
         "created_time": "2010-10-22T15:53:36+0000",
         "updated_time": "2010-10-22T15:55:23+0000",
         "comments": {}
},

Once you have the object ID, you can access it by simply placing it as the first paramter of the graph URL. E.g:

https://graph.facebook.com/40796308305

From there, you should be able to grab the actual URL to the images (depending on permission settings)

{
   "id": "40796308305",
   "name": "Coca-Cola",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs236.ash2/50516_40796308305_7651_s.jpg",
   "link": "http://www.facebook.com/coca-cola",
   "category": "Company",
   "website": "http://www.coca-cola.com",
   "username": "coca-cola",
   "products": "Coca-Cola is the most popular and biggest-selling soft drink in history, as well as the best-known product in the world.\n\nCreated in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage by mixing Coca-Cola syrup with carbonated water. Coca-Cola was introduced in 1886, patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States.\n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
   "likes": 22264613
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜