2011-02-07 4 views

답변

4

소셜 그래프를 사용하면 스크립트에 facebook 페이지 앱 ID에 대한 액세스 토큰이 있거나 사진 권한이 완전히 공개로 설정되어 있으면이 작업을 수행 할 수 있습니다.

소셜 그래프를 사용하면 기본적으로 웹 서비스와 같은 REST를 통해 사진에 액세스합니다. 그래서 첫 번째 단계는 위와 같은 URL을 사용하여 앨범을 검색하는 것입니다

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

(코카콜라 팬 페이지에 대한 사진 앨범)

다음 웹 서비스 호출은 dataExample의 JSON 개체를 반환합니다. 사진 앨범을 탐색하고 원하는 앨범의 객체 ID를 가져옵니다.

{ 
     "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": {} 
}, 

일단 개체 ID가 있으면 그래프 URL의 첫 번째 매개 변수로 배치하면됩니다. 예 : 거기에서

https://graph.facebook.com/40796308305 

, 당신은

{ 
    "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

이 훌륭합니다, 우리의 방문자가에 댓글을 달 수있는 방법이있다 (권한 설정에 따라 다름) 이미지의 실제 URL을 잡을 수 있어야합니다 사진과 그 다음 코멘트는 facebook에도 나타날 것이다? – steven

관련 문제