888件ヒット
[1-100件を表示]
(0.102秒)
別のキーワード
種類
- インスタンスメソッド (708)
- 特異メソッド (84)
- 文書 (60)
- クラス (24)
- ライブラリ (12)
ライブラリ
-
net
/ http (816)
クラス
-
Net
:: HTTP (264) -
Net
:: HTTPGenericRequest (36) -
Net
:: HTTPResponse (108)
モジュール
-
Net
:: HTTPExceptions (12) -
Net
:: HTTPHeader (372)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Get (12)
- HTTPRequest (12)
-
NEWS for Ruby 2
. 0 . 0 (12) - Proxy (12)
- [] (12)
- []= (12)
-
add
_ field (12) -
basic
_ auth (12) - body (12)
- chunked? (12)
- code (12)
-
content
_ length (12) -
content
_ length= (12) -
content
_ range (12) -
content
_ type= (12) - delete (12)
- each (12)
-
each
_ capitalized _ name (12) -
each
_ header (12) -
each
_ key (12) -
each
_ name (12) -
each
_ value (12) - entity (12)
- fetch (36)
-
form
_ data= (12) - get2 (24)
-
get
_ fields (12) -
get
_ print (24) -
get
_ response (24) - head2 (24)
-
http
_ version (12) - key? (12)
-
local
_ host= (12) -
local
_ port= (12) -
main
_ type (12) - method (24)
- msg (12)
- path (12)
-
proxy
_ basic _ auth (12) - range (12)
-
range
_ length (12) -
read
_ body (24) - request (24)
-
request
_ get (24) -
request
_ head (24) - response (12)
-
response
_ body _ permitted? (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 9 feature (12) -
send
_ request (12) -
set
_ content _ type (12) -
set
_ form _ data (12) -
sub
_ type (12) -
type
_ params (12) - value (12)
検索結果
先頭5件
-
net
/ http (38096.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
...からドキュメントを得る (GET)
//emlist[例1: GET して 表示するだけ][ruby]{
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/inde......例][ruby]{
require 'net/http'
require 'uri'
url = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.start(url.host, url.port) {|http|
http.get('/index.html')
}
puts res.body
//}
//emlist[例4: 上の例よりさらに汎用的な例][ruby]{
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 'uri'
#例1: POSTするだけ
res = Net::HT... -
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (26144.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...例][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')
response.body
# compatible, using block
File.open('save.txt', 'w') {|f|
http.get('/~foo/', ni......l) do |str|
f.write str
end
}
//}
@see Net::HTTP#request_get... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (26144.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...例][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')
response.body
# compatible, using block
File.open('save.txt', 'w') {|f|
http.get('/~foo/', ni......l) do |str|
f.write str
end
}
//}
@see Net::HTTP#request_get... -
Net
:: HTTP . get(host , path , port = 80) -> String (26124.0) -
指定した対象に GET リクエストを送り、そのボディを 文字列として返します。
...指定した対象に GET リクエストを送り、そのボディを
文字列として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host......接続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get... -
Net
:: HTTP . get(uri) -> String (26124.0) -
指定した対象に GET リクエストを送り、そのボディを 文字列として返します。
...指定した対象に GET リクエストを送り、そのボディを
文字列として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host......接続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get... -
Net
:: HTTP . get _ print(host , path , port = 80) -> () (14132.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) -> () (14132.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 # get2(path , header = nil) -> Net :: HTTPResponse (14128.0) -
サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。
...nse = 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 (14128.0) -
サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。
...nse = 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...