help me with Net::HTTP

T

travis laduke

please?
#from the api on ruby-doc.org. http://www.ruby-doc.org/stdlib/libdoc/
net/http/rdoc/classes/Net/HTTP.html

require 'net/http'
require 'uri'

#1: Simple POST
res = Net::HTTP.post_form(URI.parse('http://www.example.com/
search.cgi'),
{'q'=>'ruby', 'max'=>'50'})
puts res.body


5: undefined method `post_form' for Net::HTTP:Class (NoMethodError)

am i missing something here? if it matters, my OS is Tiger... ruby
1.8.2 (2004-12-25) [powerpc-darwin8.2.0]

alternatively, how to you make Mechanize work from inside rails? i'm
trying to screen scrape a table from another site then load the
information back on my page.

why does time fly so fast when i'm stuck on something?

travid
 
R

Robert Klemme

travis said:
please?
#from the api on ruby-doc.org. http://www.ruby-doc.org/stdlib/libdoc/
net/http/rdoc/classes/Net/HTTP.html

require 'net/http'
require 'uri'

#1: Simple POST
res = Net::HTTP.post_form(URI.parse('http://www.example.com/
search.cgi'),
{'q'=>'ruby', 'max'=>'50'})
puts res.body


5: undefined method `post_form' for Net::HTTP:Class (NoMethodError)

am i missing something here? if it matters, my OS is Tiger... ruby
1.8.2 (2004-12-25) [powerpc-darwin8.2.0]

Works for me (cygwin, Ruby 1.8.4). Maybe it was renamed. Try

ruby -r net/http -e 'puts Net::HTTP.public_methods.grep(/post/i).sort'

ruby -r net/http -e 'puts Net::HTTP.public_methods.sort'
why does time fly so fast when i'm stuck on something?

Hehe, know that - been there before. Sometimes it helps to just have a
break.

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Net::http 2
Net::HTTP.post_form missing method error 5
Help with net/http 18
net/http broken? 7
ssl encryption with post_form() 3
Wikipedia Bot 15
Net::HTTP and post_form 0
Ruby doesn't work correctly 1

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top