Class | Curl::Multi |
In: |
lib/curb.rb
|
Parent: | Object |
href="Multi.html#M000007">Curl::Multi.download(|}
will create 2 new files file1.txt and file2.txt
2 files will be opened, and remain open until the call completes
when using the :post or :put method, urls should be a hash, including the individual post fields per post
{ :url => 'url1', :method => :post, :post_fields => {'field1' => 'value1', 'field2' => 'value2'} }, { :url => 'url2', :method => :get, :follow_location => true, :max_redirects => 3 }, { :url => 'url3', :method => :put, :put_data => File.open('file.txt','rb') }, { :url => 'url4', :method => :head }
], {:pipeline => true})
Blocking call to issue multiple HTTP requests with varying verb‘s.
urls_with_config: is a hash of url‘s pointing to the easy handle options as well as the special option :method, that can by one of [:get, :post, :put, :delete, :head], when no verb is provided e.g. :method => nil -> GET is used multi_options: options for the multi handle blk: a callback, that yeilds when a handle is completed
Curl::Multi.post([{:url => 'url1', :post_fields => {'field1' => 'value1', 'field2' => 'value2'}}, {:url => 'url2', :post_fields => {'field1' => 'value1', 'field2' => 'value2'}}, {:url => 'url3', :post_fields => {'field1' => 'value1', 'field2' => 'value2'}}], { :follow_location => true, :multipart_form_post => true }, {:pipeline => true }) do|easy| easy_handle_on_request_complete end
Blocking call to POST multiple form‘s in parallel.
urls_with_config: is a hash of url‘s pointing to the postfields to send easy_options: are a set of common options to set on all easy handles multi_options: options to set on the Curl::Multi handle
Curl::Multi.put([{:url => 'url1', :put_data => "some message"}, {:url => 'url2', :put_data => IO.read('filepath')}, {:url => 'url3', :put_data => "maybe another string or socket?"], {:follow_location => true}, {:pipeline => true }) do|easy| easy_handle_on_request_complete end
Blocking call to POST multiple form‘s in parallel.
urls_with_config: is a hash of url‘s pointing to the postfields to send easy_options: are a set of common options to set on all easy handles multi_options: options to set on the Curl::Multi handle