るりまサーチ

最速Rubyリファレンスマニュアル検索!
121件ヒット [1-100件を表示] (0.158秒)

別のキーワード

  1. _builtin read
  2. stringio read
  3. io read
  4. csv read
  5. tuple read_all

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Net::HTTPResponse#read_body(dest=nil) -> String|nil (18221.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...い場合には nil を返します。

//emlist[例1 ブロックを与えずに一度に結果取得][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://www.example.com/path/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 で少しずつ読み書き。メモリ消費が少ない。...
...クトは使わないでください。

dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@param dest obsoleteな引数です。利用しないでください...

Net::HTTP#get2(path, header = nil) -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...定します。

//emlist[例][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body...
...now
print str
end
}
//}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#get2(path, header = nil) {|response| .... } -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...定します。

//emlist[例][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body...
...now
print str
end
}
//}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#post2(path, data, header = nil) -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...るエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } と...
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

@param path POST先のエンティティのパスを文字列で指定します。
@param data POSTするデ...
...post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response = http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
http.request_post('/cgi-bin/nice.rb', 'datadatadata...') {|resp...

Net::HTTP#post2(path, data, header = nil) {|response| .... } -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...るエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } と...
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

@param path POST先のエンティティのパスを文字列で指定します。
@param data POSTするデ...
...post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response = http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
http.request_post('/cgi-bin/nice.rb', 'datadatadata...') {|resp...

絞り込み条件を変える

Net::HTTP#request_get(path, header = nil) -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...定します。

//emlist[例][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body...
...now
print str
end
}
//}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#request_get(path, header = nil) {|response| .... } -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...定します。

//emlist[例][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body...
...now
print str
end
}
//}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#request_post(path, data, header = nil) -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...るエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } と...
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

@param path POST先のエンティティのパスを文字列で指定します。
@param data POSTするデ...
...post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response = http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
http.request_post('/cgi-bin/nice.rb', 'datadatadata...') {|resp...

Net::HTTP#request_post(path, data, header = nil) {|response| .... } -> Net::HTTPResponse (113.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...るエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } と...
...ダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

@param path POST先のエンティティのパスを文字列で指定します。
@param data POSTするデ...
...post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response = http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
http.request_post('/cgi-bin/nice.rb', 'datadatadata...') {|resp...

Net::HTTPResponse#body -> String | () | nil (107.0)

エンティティボディを返します。

...ない場合には nil を返します。

Net::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

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

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.body[0..10] # => "<!doctype h"
//}...

絞り込み条件を変える

<< 1 2 > >>