Rubyスクリプトから別のページのFacebookのステータスを確認したかった. まずそれが可能かどうか。私は次のことを行ってきました:
- 開発者アカウントを取得しました
- アプリキーとシークレットを取得しました
- json_pure gemをインストールしました
これが私のコードです:
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)
エラーは次のとおりです。
C:/Ruby187/lib/ruby/1.8/net/protocol.rb:135:in `sysread': An existing connection
was forcibly closed by the remote host. (Errno::ECONNRESET)