228件ヒット
[1-100件を表示]
(0.105秒)
別のキーワード
種類
- インスタンスメソッド (180)
- 特異メソッド (24)
- ライブラリ (12)
- 文書 (12)
ライブラリ
-
net
/ http (204)
クラス
-
Net
:: HTTP (24) -
Net
:: HTTPResponse (108)
モジュール
-
Net
:: HTTPExceptions (12) -
Net
:: HTTPHeader (60)
キーワード
- body (12)
- code (12)
- entity (12)
-
get
_ fields (12) -
http
_ version (12) - key? (12)
-
main
_ type (12) - msg (12)
-
net
/ http (12) -
read
_ body (24) - response (12)
-
sub
_ type (12) -
type
_ params (12) - value (12)
- 制御構造 (12)
検索結果
先頭5件
-
Net
:: HTTP . get _ response(host , path = nil , port = nil) -> Net :: HTTPResponse (24202.0) -
指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。
...に GET リクエストを送り、そのレスポンスを
Net::HTTPResponse として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host 接......続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get... -
Net
:: HTTP . get _ response(uri) -> Net :: HTTPResponse (24202.0) -
指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。
...に GET リクエストを送り、そのレスポンスを
Net::HTTPResponse として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host 接......続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get... -
Net
:: HTTPHeader # get _ fields(key) -> [String] (6106.0) -
key ヘッダフィールドの値 (文字列) を配列で返します。
...key ヘッダフィールドの値 (文字列) を配列で返します。
たとえばキー 'content-length' に対しては ['2048'] のような
文字列が得られます。一種類のヘッダフィールドが一つのヘッダの中
に複数存在することがありえます。
key は......ール名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}
@see Net::HTTPHeader#[] , Net::HTTPHeader#[]=,
Net::HTTPHeader#add_field... -
Net
:: HTTPHeader # main _ type -> String|nil (6106.0) -
"text/html" における "text" のようなタイプを表す 文字列を返します。
..."text/html" における "text" のようなタイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_r......esponse(uri)
res.main_type # => "text"
//}... -
Net
:: HTTPHeader # sub _ type -> String|nil (6106.0) -
"text/html" における "html" のようなサブタイプを表す 文字列を返します。
..."text/html" における "html" のようなサブタイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.......get_response(uri)
res.sub_type # => "html"
//}... -
Net
:: HTTPHeader # type _ params -> Hash (6106.0) -
Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。
...ntent-Type のパラメータを {"charset" => "iso-2022-jp"}
という形の Hash で返します。
Content-Type: ヘッダフィールドが存在しない場合には
空のハッシュを返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.htm......l')
res = Net::HTTP.get_response(uri)
res.type_params # => {"charset"=>"UTF-8"}
//}... -
Net
:: HTTPResponse # entity -> String | () | nil (6106.0) -
エンティティボディを返します。
...す。
Net::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。
entity は obsolete です。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.exampl......e.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.body[0..10] # => "<!doctype h"
//}... -
Net
:: HTTPResponse # http _ version -> String (6106.0) -
サーバがサポートしている HTTP のバージョンを文字列で返します。
...サーバがサポートしている HTTP のバージョンを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.http_version # => "1.1"
//}... -
net
/ http (6006.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
...ル HTTP を扱うライブラリです。
実装は 2616 に基きます。
=== 使用例
==== ウェブサーバからドキュメントを得る (GET)
//emlist[例1: GET して 表示するだけ][ruby]{
require 'net/http'
print Net::HTTP.get('www.example.com', '/index.html')
//}
//emlist[例......et/http'
require 'uri'
print Net::HTTP.get(URI.parse('http://www.example.com/index.html'))
//}
//emlist[例3: より汎用的な例][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.htm......limit 回数以上リダイレクトしたらエラーにします。
//emlist[例][ruby]{
require 'net/http'
require 'uri'
def fetch(uri_str, limit = 10)
# You should choose better exception.
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
response = Net::HTTP.get_response(URI...