net/http POSTING form data help

A

Asfand Yar Qazi

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
 
F

from_google

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.
 

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

Staff online

Members online

Forum statistics

Threads
474,262
Messages
2,571,045
Members
48,769
Latest member
Clifft

Latest Threads

Top