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
-----------------
When I use:
res
Net::HTTP.post_form(URI.parse(''http://www.xxx.com/script.php?op=publish''),
{"ch" => 0, "cnt" => "something"})
http://www.xxx.com/script.php?op=publish
ch0cntsomething
There are no = and & so I think that fails on the php script...
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi, any hints anyone? Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 21, 11:06 pm, Pod Caster <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> When I use: > res > Net::HTTP.post_form(URI.parse(''http://www.xxx.com/script.php?op=publish''), > {"ch" => 0, "cnt" => "something"}) > > http://www.xxx.com/script.php?op=publish > ch0cntsomething > > There are no = and & so I think that fails on the php script... >That should work. What makes you think the & and = are missing ? Have you looked at the data going over the wire ? Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 22 Sep 2008, at 09:41, Pod Caster wrote:> > 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. > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---