How to generate this request with NET::HTTP

Hi,

Whith NET::HTTP.post_form how can I generate the next request?

POST /script.php?op=publish HTTP/1.1 ... ...

ch=0&cnt=something

Hi, any hints anyone?

Thanks.

That should work. What makes you think the & and = are missing ? Have you looked at the data going over the wire ?

Fred

I was using puts to check it but I'm not sure I doing it correctly.

How can I see the generated request before it is sent by post_form? I can't seem to catch it with the Fiddler tool.

Thanks.

I was using puts to check it but I'm not sure I doing it correctly.

That wouldn't do much - it probably just called puts on the hash, and
push for hashes isn't very useful.

How can I see the generated request before it is sent by post_form?

I don't think you can (unless you use the rather more verbose forms of
the Net::HTTP api)

I can't seem to catch it with the Fiddler tool.

I would have tried tcpdump, ethereal etc... What does the data look
like when it appears at the php script (or do you no control that)

Fred

Thanks again Fred. I used Ethereal now. And yes the arguments are there correctly!

What I found is that the next line: Net::HTTP.post_form(URI.parse('http://www.something.com/script.php?op=publish’), {"ch" => 0, "cnt" => "something"})

Produces:

POST http://www.something.com/script.php HTTP/1.1 Accept: */* Content-Type: application/x-www-form-urlencoded Content-Length: 14 Host: www.something.com

ch=0&cnt=sometext

So it leaves out the ?op=publish from the url I need to look into that now.

Thanks for your suggestions!

Hi,

Here's how I got the thing working:

http = Net::HTTP.new('www.something.com') resp = http.post('/script.php?op=publish', 'ch=0&cnt=something')

Regards