简单使用带导轨的facebook图3

问题描述

|| 我想在用户使用登录按钮登录获取用户内容 因此,我需要将此代码PHP转换为rails 3
$user = json_decode(file_get_contents(
\'https://graph.facebook.com/me?access_token=\' .
$cookie[\'access_token\']));
我不想使用像httparty这样的gem。 我尝试此代码没有成功
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 \']包含用户的正确access_token 我收到的错误消息是
end of file reached
    

解决方法

        我最终使用了open-uri
content = open(URI.encode(\'https://graph.facebook.com/me?access_token=\' + fbhash[\'access_token\']))
content = ActiveSupport::JSON.decode(content)
很棒