[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how do I post to a form (http) in Ruby 1.8.2?

Dan Tenenbaum

3/13/2006 7:40:00 PM

Hi all,

How do I do the equivalent of Net::HTTP.post_form() in Ruby 1.8.2? (This
method was not implemented until 1.8.3).

This might seem like a strange question but bear with me.

Though our production server is running Ruby 1.8.4, our development
machines are Macs using Locomotive (which is a self-contained Ruby/Rails
environment). I have been told by one of the lead Locomotive developers
that it is virtually impossible to upgrade the version of Ruby inside
Locomotive, that I should wait for the next version which will use a
more current version of Ruby.

So my question is, until then, how would I make the following code
fragment, which works in 1.8.3+, work in 1.8.2?

require 'net/http'
require 'uri'

parms = {:client=>"safari", :rls=>"en", :q => "myquery",
:ie => "UTF-8", :oe => "UTF-8"}
url = "http://www.google.com/se...

res = Net::HTTP.post_form(URI.parse(url), parms)

print res.body
print

(By "work", I mean, getting something back from the server--in this
particular case the server may return an error, but at least the post
succeeded.)

It has been suggested that I extend Ruby to implement this method. I
gave that a try and it didn't seem too easy, as post_form in turn
depends on other methods that don't exist in 1.8.2. But I am a total
newbie at extending Ruby so it could be I missed something

I couldn't get the examples of request_post to work either.

At this point I don't care what approach I use, I just want to be able
to post to a form on an http server in Ruby 1.8.2. Any idea what would
be the quickest way to do that?
Thanks



--
Posted via http://www.ruby-....


1 Answer

sugarless anko

7/2/2011 2:46:00 PM

0

On 7?2?, ??10:53, "AleXX®" <dalaibaru@bishop_aka_tweety.net> wrote:
> You are wrong Mr. annihilated anko.
> What would happen from now on till year 2020; more natural disasters like
> the one that causes nuclear leaks at FUCKushima prefecture will destroy and
> wipe the japs out of the world map. This is just a repercussion and by the
> wrath of nature for cruelty and atrocities the japs did to the people and
> civilians of Asia during WW2. Even the 2 atomic bombs; a gifts from USA, and
> delivered to Nagasucki and Hellrockshitma were not enough.
>
>
>
>
>
>
>
> > "radiated anko" <serbet...@gmail.com> wrote in message
> >news:f826e855-4898-43c2-948b-789ce1031883@q29g2000prj.googlegroups.com...
> > Chinese authority already declared that there will be no country
> > called Japan in year 2020. China has been preparing to invade Japan. I
> > have questions. In China, all land are government property and China
> > does not allow individual possession of land. When China invade Japan
> > and occupy it, will it confiscate all the land the ????, "little nips"
> > possessing now? Or will it just butcher all the nips to racially clean
> > up the islands and confiscate all the lands and properties of them? If
> > so, I would sell all the properties I own now then move to some safe
> > place. I don't want get butchered.

It's been told that the 311 earthquake is caused by the HAARP of the
USA. The funny racist USA is still not satisfied after two A-bombs so
the ugly sadist Clinton pushed the botton of the HAARP.