740件ヒット
[1-100件を表示]
(0.155秒)
別のキーワード
ライブラリ
-
net
/ http (696)
クラス
-
Net
:: HTTP (480) -
Net
:: HTTPResponse (180)
モジュール
-
Net
:: HTTPExceptions (12)
キーワード
-
CODE
_ CLASS _ TO _ OBJ (12) -
CODE
_ TO _ OBJ (12) - HTTPExceptions (12)
-
NEWS for Ruby 2
. 5 . 0 (8) - body (12)
-
body
_ permitted? (12) - code (12)
- copy (12)
- delete (12)
- entity (12)
- get (24)
- get2 (24)
-
get
_ response (24) - head (12)
- head2 (24)
- header (12)
-
http
_ version (12) - lock (12)
- mkcol (12)
- move (12)
- msg (12)
- patch (24)
- post (24)
- post2 (24)
-
post
_ form (12) - propfind (12)
- proppatch (12)
- put (12)
- put2 (24)
-
read
_ body (24) -
reader
_ header (12) - request (24)
-
request
_ get (24) -
request
_ head (24) -
request
_ post (24) -
request
_ put (24) - response (24)
-
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 9 feature (12) -
send
_ request (12) - trace (12)
- unlock (12)
- value (12)
検索結果
先頭5件
-
net
/ http (38054.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 '......end
end
print fetch('http://www.example.org')
//}
より詳しくは Net::HTTPResponse、 Net::HTTPSuccess、
Net::HTTPRedirection を参照してください。
==== Basic 認証
//emlist[例][ruby]{
require 'net/http'
Net::HTTP.start('www.example.com') {|http|
req = Net::HTTP::Get.new('/se... -
Net
:: HTTPResponse (26016.0) -
HTTP レスポンスを表現するクラスです。 Net::HTTP クラスは実際には HTTPResponse のサブクラスを返します。
...HTTP レスポンスを表現するクラスです。
Net::HTTP クラスは実際には HTTPResponse のサブクラスを返します。... -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (11018.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http:/......h/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (11018.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http:/......h/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do... -
Net
:: HTTPResponse # value -> nil (11018.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
...スが 2xx(成功)でなかった場合に、対応する
例外を発生させます。
@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx......レスポンスが 2xx(成功)][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
//}
//emlist[例 レスポンスが 2xx以外][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
respo... -
Net
:: HTTPResponse # body -> String | () | nil (11012.0) -
エンティティボディを返します。
...します。
Net::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。
entity は obsolete です。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.... -
Net
:: HTTPResponse # entity -> String | () | nil (11012.0) -
エンティティボディを返します。
...します。
Net::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。
entity は obsolete です。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.... -
Net
:: HTTPResponse :: CODE _ CLASS _ TO _ OBJ -> Hash (11012.0) -
HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を あらわすクラスへのハッシュです。
...HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を
あらわすクラスへのハッシュです。
//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_CLASS_TO_OBJ['3'] # => Net::HTTPRedirection
//}... -
Net
:: HTTPResponse :: CODE _ TO _ OBJ -> Hash (11012.0) -
HTTP レスポンスステータスコードから対応するクラスへのハッシュです。
...HTTP レスポンスステータスコードから対応するクラスへのハッシュです。
//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
//}...