Posted By

paramah on 01/05/09


Tagged

curl ruby


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

sergeizen
webstic
Priestd09


fetch site in ruby


 / Published in: Ruby
 

  1. #!/usr/local/bin/ruby
  2. require 'rubygems'
  3. require 'curl-multi'
  4.  
  5.  
  6. curl = Curl::Multi.new
  7.  
  8.  
  9. on_success = lambda do |body|
  10. puts body
  11. end
  12.  
  13. on_failure = lambda do |ex|
  14. puts 'Failure.'
  15. puts ex
  16. end
  17.  
  18.  
  19. curl.get('http://www.wp.pl', on_success, on_failure)
  20. curl.select([],[]) while curl.size > 0;

Report this snippet  

You need to login to post a comment.