36件ヒット
[1-36件を表示]
(0.040秒)
検索結果
-
net
/ http (38066.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
...y]{
require 'net/http'
print Net::HTTP.get('www.example.com', '/index.html')
//}
//emlist[例2: URI を使う][ruby]{
require 'net/http'
require 'uri'
print Net::HTTP.get(URI.parse('http://www.example.com/index.html'))
//}
//emlist[例3: より汎用的な例][ruby]{
require 'net/http'
require 'ur......{
require 'net/http'
url = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
//}
==== フォームの情報を送信する (POST)
//emlist[例][ruby]{
require 'net/http'
require '......_form_data({'from'=>'2005-01-01', 'to'=>'2005-03-31'})
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
case res
when Net::HTTPSuccess, Net::HTTPRedirection
# OK
else
res.value
end
//}
==== プロクシ経由のアクセス
Net::HTTP は http_proxy 環境変数が存... -
Net
:: HTTPSuccess (11000.0) -
HTTP レスポンス 2xx (Success) を表現するクラスです。
HTTP レスポンス 2xx (Success) を表現するクラスです。
リクエストが正常に受信、処理されたことを表しています。 -
Net
:: HTTPResponse . body _ permitted? -> bool (8012.0) -
エンティティボディを含むことが許されているレスポンスクラス ならば真を、そうでなければ偽を返します。
...エンティティボディを含むことが許されているレスポンスクラス
ならば真を、そうでなければ偽を返します。
//emlist[例][ruby]{
require 'net/http'
Net::HTTPSuccess.body_permitted? # => true
Net::HTTPNotModified.body_permitted? # => false
//}...