Checking Facebook Status Using Ruby -
i wanted check facebook status of page ruby script. first of possible. have been doing following:
- i got developer account
- i got app key , secret
- i installed json_pure gem
here code:
require 'rubygems' require 'json/pure' require 'net/http' url ="https://graph.facebook.com/user_id/feed?access_token=app_id|app_secret" uri = uri.parse(uri.encode(url.strip)) #to remove specia codes encode #to remoce whitespace strip req = net::http::get.new(uri.to_s) res = net::http.start(uri.host, uri.port) {|http| http.request(req) } html = res.body res = json.parse(html)
here error:
c:/ruby187/lib/ruby/1.8/net/protocol.rb:135:in `sysread': existing connection forcibly closed remote host. (errno::econnreset)
i recommend using koala gem instead of net::http
@graph = koala::facebook::api.new(oauth_access_token) status = @graph.get_connections("me", user_id, "status")
Comments
Post a Comment