I want to get the user content after he sign in with the login button
therefore I need to convert this code from php to rails 3
$user = json_decode(file_get_contents(
'https://graph.facebook.com/me?access_token=' .
$cookie['access_token']));
I don't want to use any gem like httparty.
I tried this code with no success
uri = URI.parse(URI.encode('https://graph.facebook.com/me?access_token=' + fbhash['access_token']))
require 'net/http'
content = Net::HTTP.get(uri)
content = ActiveSupport::JSON.decode(content)
fbhash['access_token'] contain the right access_token for the user
the e开发者_JAVA百科rror message I get is
end of file reached
I ended up using open-uri
content = open(URI.encode('https://graph.facebook.com/me?access_token=' + fbhash['access_token']))
content = ActiveSupport::JSON.decode(content)
works great
精彩评论