るりまサーチ

最速Rubyリファレンスマニュアル検索!
204件ヒット [1-100件を表示] (0.041秒)
トップページ > クエリ:form[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/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"
//}...
<< 1 2 3 > >>