204件ヒット
[1-100件を表示]
(0.041秒)
種類
- インスタンスメソッド (132)
- クラス (24)
- 文書 (24)
- 特異メソッド (12)
- ライブラリ (12)
ライブラリ
-
net
/ http (168)
クラス
-
Net
:: HTTP (84)
モジュール
-
Net
:: HTTPHeader (60)
キーワード
- HTTPInformation (12)
- HTTPNonAuthoritativeInformation (12)
-
content
_ type (12) -
content
_ type= (12) -
form
_ data= (12) - post (24)
- post2 (24)
-
post
_ form (12) -
request
_ post (24) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
set
_ content _ type (12) -
set
_ form _ data (12)
検索結果
先頭5件
-
net
/ http (38078.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 '......uri'
#例1: POSTするだけ
res = Net::HTTP.post_form(URI.parse('http://www.example.com/search'),
{'q'=>'ruby', 'max'=>'50'})
puts res.body
#例2: 認証付きで POST する
res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'),... -
Net
:: HTTPHeader # form _ data=(params) (14150.0) -
HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。
...t-Type: には
'application/x-www-form-urlencoded' が設定されます。
@param params HTML のフォームデータの Hash を与えます。
@param sep データのセパレータを文字列で与えます。
//emlist[例 form_data][ruby]{
require 'net/http'
uri = URI.parse('http://www.exa.......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('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.set_form_data({"q" => "rub......y", "lang" => "en"}, ';') # => "application/x-www-form-urlencoded"
//}... -
Net
:: HTTPHeader # set _ form _ data(params , sep = & # 39;&& # 39;) -> () (14150.0) -
HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。
...t-Type: には
'application/x-www-form-urlencoded' が設定されます。
@param params HTML のフォームデータの Hash を与えます。
@param sep データのセパレータを文字列で与えます。
//emlist[例 form_data][ruby]{
require 'net/http'
uri = URI.parse('http://www.exa.......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('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.set_form_data({"q" => "rub......y", "lang" => "en"}, ';') # => "application/x-www-form-urlencoded"
//}... -
Net
:: HTTP . post _ form(uri , params) -> Net :: HTTPResponse (14101.0) -
URI で指定した対象に フォームのデータを HTTP で POST します。
URI で指定した対象に フォームのデータを HTTP で
POST します。
送るデータは params に文字列から文字列への Hash として
渡します。
@param uri POST する対象を URI で指定します。
@param params POST するデータです。 -
Net
:: HTTPInformation (14000.0) -
HTTP レスポンス 1xx (Informational) を表現するクラスです。
...HTTP レスポンス 1xx (Informational) を表現するクラスです。
リクエストが正常に受信し、処理を続けていることを表わして
います。... -
Net
:: HTTPNonAuthoritativeInformation (14000.0) -
HTTP レスポンス 203 (Non-Authoritative Information) を表現するクラスです。
...HTTP レスポンス 203 (Non-Authoritative Information) を表現するクラスです。
詳しくは 7231 Section 6.3.4 を見てください。... -
Net
:: HTTPHeader # content _ type=(type) (8024.0) -
type と params から Content-Type: ヘッダフィールドの 値を設定します。
...uire 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_type # => nil
req.content_type = 'multipart/form-data' # => "multipart/form-data"
req.content_type # => "multipart/form-data"... -
Net
:: HTTPHeader # set _ content _ type(type , params = {}) (8024.0) -
type と params から Content-Type: ヘッダフィールドの 値を設定します。
...uire 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_type # => nil
req.content_type = 'multipart/form-data' # => "multipart/form-data"
req.content_type # => "multipart/form-data"... -
Net
:: HTTPHeader # content _ type -> String|nil (8018.0) -
"text/html" のような Content-Type を表す 文字列を返します。
...は nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
req = Net::HTTP::Post.new(uri.request_uri)
req.content_type # => nil
req.content_type = 'multipart/form-data'
req.content_type # => "multipart/form-data"
//}...