Created
September 7, 2011 00:29
-
-
Save jamesladd/1199405 to your computer and use it in GitHub Desktop.
Writing to facebook users wall server side ....
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'koala' | |
# | |
# initialize a Graph API connection | |
@oauth = Koala::Facebook::OAuth.new(app_id, code, "https://www.facebook.com/connect/login_success.html") | |
@url_for_oauth_code = @oauth.url_for_oauth_code(:permissions => "publish_stream") | |
puts @url_for_oauth_code.inspect | |
# Goto the URL printed above in your browser - it should print 'success' and in the | |
# url will be the access code. Paste that in below as "access_code" | |
@access_code = "<paste data from above here>" | |
# first, initialize a Graph API with your token | |
puts @graph = Koala::Facebook::GraphAPI.new(@access_code) | |
@friends = @graph.get_connections("me", "friends") | |
puts @friends.inspect | |
@friend = @friends[0] | |
puts "Writing public data ..." | |
#now try writing to friends wall | |
puts @friend['id'] | |
puts @graph.put_wall_post("I can't believe its not butter.", {}, @friend['id']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment