Hi all, this may sound basic, but I''m not able to figure out how to initiate an http post action from within a controller. What I''m trying to do is use a def function in one of my application controllers to send a post on to another URI (using the http POST method) that is not on my server. I tried post(path, parameters=nil, headers=nil) but only got an error message saying post method not found. I also tried a redirect, but it seems this method only wants to initiate http GET actions. Any ideas or examples? Thanks, Doug -- 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 -~----------~----~----~----~------~----~------~--~---
> What I''m trying to do is use a def function in one of my > application controllers to send a post on to another URI > (using the http POST > method) that is not on my server.You''re going to want to look at the net/http and/or mechanize libraries for that.> I also tried a redirect, but it seems this method only wants > to initiate http GET actions.Do you mean you want your response to the originating client to cause it to issue a POST request to an arbitrary URL? You can''t do that. You can have the rails app issue a POST request, but you can''t force the originating client to do so. - donald --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ball, Donald A Jr (Library) wrote:>> What I''m trying to do is use a def function in one of my >> application controllers to send a post on to another URI >> (using the http POST >> method) that is not on my server. > > You''re going to want to look at the net/http and/or mechanize libraries > for that. > >> I also tried a redirect, but it seems this method only wants >> to initiate http GET actions. > > Do you mean you want your response to the originating client to cause it > to issue a POST request to an arbitrary URL? You can''t do that. You can > have the rails app issue a POST request, but you can''t force the > originating client to do so. > > - donaldThanks Don. No, I don''t want my response to the originating client to cause it to issue a POST request to an arbitrary URL? All I want to do is generate an HTTP POST (to another URL from within the controller -- as opposed to presenting a form to a user and waiting for the user click a submit button. For example, my application has a form that when submitted posts data to a third party shopping cart application. When users are in that application, they can hit a "continue shopping" button which generates a GET request to my application. Instead of actually showing the user a catalog, I simply want to catch the GET request and automatically generate a POST back to the third party shopping cart application. I''ll do as you suggest and take a look at net/http library. Thanks again, Doug -- 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 -~----------~----~----~----~------~----~------~--~---