るりまサーチ

最速Rubyリファレンスマニュアル検索!
3161件ヒット [1-100件を表示] (0.038秒)
トップページ > ライブラリ:net/http[x] > クエリ:net/http[x]

別のキーワード

  1. net/smtp start
  2. net/http get
  3. net/imap name
  4. net/imap param
  5. net/http start

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Net::HTTPHeader#fetch(key) -> String (8026.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

Net::HTTPHeader#fetch(key) {|hash| .... } -> String (8026.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

Net::HTTPHeader#fetch(key, default) -> String (8026.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

Net::HTTPResponse#value -> nil (8020.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::HTTP#get(path, header = nil, dest = nil) -> Net::HTTPResponse (8014.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...、返り値が [レスポンスオブジェクト, そのボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.html'...

絞り込み条件を変える

Net::HTTP#get(path, header = nil, dest = nil) {|body_segment| .... } -> Net::HTTPResponse (8014.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...、返り値が [レスポンスオブジェクト, そのボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.html'...

Net::HTTP.Proxy(address, port = 80) -> Class (8014.0)

Proxy 経由で http サーバに接続するためのクラスを作成し返します。

...][ruby]{
require 'net/http'
proxy_class = Net::HTTP::Proxy('proxy.example.com', 8080)
http = proxy_class.new('www.example.org')
http.start {|h|
h.get('/ja/') # proxy.example.com 経由で接続します。
}
//}

//emlist[例2: Net::HTTP.start を使う][ruby]{
require 'net/http'
proxy_class = Net...

Net::HTTP.get_print(host, path, port = 80) -> () (8014.0)

指定した対象から HTTP でエンティティボディを取得し、 $stdout に出力します。

...ートを整数で指定します。
@see Net::HTTP.get

=== 例

//emlist[][ruby]{
require 'net/http'
require 'uri'
Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
//}

もしくは

//emlist[][ruby]{
require 'net/http'
Net::HTTP.get_print 'www.example.com', '/index.html'
//}...

Net::HTTP.get_print(uri) -> () (8014.0)

指定した対象から HTTP でエンティティボディを取得し、 $stdout に出力します。

...ートを整数で指定します。
@see Net::HTTP.get

=== 例

//emlist[][ruby]{
require 'net/http'
require 'uri'
Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
//}

もしくは

//emlist[][ruby]{
require 'net/http'
Net::HTTP.get_print 'www.example.com', '/index.html'
//}...

Net::HTTPHeader#form_data=(params) (8014.0)

HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。

...][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.form_data = {"q" => ["ruby", "perl"], "lang" => "en"} # => {"q"=>["ruby", "perl"], "lang"=>"en"}
//}

//emlist[例 set_form_data][ruby]{
require 'net/http'

uri = URI.parse...

絞り込み条件を変える

<< 1 2 3 ... > >>