2011-08-29 36 views

回答

0
require 'net/http' 
fb = Net::HTTP.get_response(URI.parse("https://graph.facebook.com/#{request_id}?#{app_token}")).body 
request_content = ActiveSupport::JSON.decode(fb) 
+0

Xarem您好我試過以上代碼中陳述,我得到這個錯誤:錯誤的URI (不是URI?)。有任何想法嗎? – chell

+0

你有網址編碼你的參數嗎?試試URI.parse(URI.encode(「http:// ...」))。 URL可能包含特殊字符,如變音符號。 – Ueli

+0

由於這是對HTTPS的調用,我不需要使用'net/https'嗎? – chell

0

沒有測試,但嘗試這樣的事:

require 'net/http' 
request_content = Net::HTTP.get_response(URI.parse("https://graph.facebook.com/#{request_id}?#{app_token}")).body 
相關問題