[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

net/http POSTING form data help

Asfand Yar Qazi

4/10/2005 6:35:00 PM

Hello,

I've got one of them origo 4 port ADSL routers, and the only way of
turning the firewall on and off is via the http interface. So, I
cooked up some code that (I thought) would do that:

#!/usr/bin/ruby -w

require 'net/http'

enabled = 1

STUFF = "WINDWEB_URL=%2Fdoc%2Ffwbsd.htm&saveFW=0&fw_func_enable=1"

Net::HTTP.start('router.qazi') do |http|
req = Net::HTTP::Post.new("/doc/fwbsd.htm")
req.basic_auth('admin', 'SECRETPASSWORD')
response = http.request(req, STUFF)
puts(response.body)
end

I get the following output:

Web Server Error Report:<HR>
<H1>Server Error: 501 Not Implemented</H1>
<P><HR><H2>No RPM for this combination of URL and
method</H2><P><P><HR><H1>/doc/fwbsd.htm</H1><P>


I assume you'll be able to pick up what I'm trying to do. Anyone know
why it does'nt work? Manually typing the request into the browser URL
(separated with '?') works fine.

Thanks,
Asfand Yar
1 Answer

from_google

4/13/2005 8:22:00 PM

0

> I get the following output:
>
> Web Server Error Report:<HR>
> <H1>Server Error: 501 Not Implemented</H1>
> <P><HR><H2>No RPM for this combination of URL and
> method</H2><P><P><HR><H1>/doc/fwbsd.htm</H1><P>
>
> I assume you'll be able to pick up what I'm trying to do. Anyone
know
> why it does'nt work? Manually typing the request into the browser
URL
> (separated with '?') works fine.
>
> Thanks,
> Asfand Yar

I think you need to use a GET rather than a POST. The 501 is saying
that you can't POST to a .htm URL.