this is the response from net/http post. <TEST><RESULT>SUCCESS</RESULT><BR> <GUID>{70fd9072-2886-4491-b968-b83396c3e24a}</GUID><BR> <SPLITS>1</SPLITS></TEST> how can i split RESULT, GUID & SPLITS, so that i can save the value in the database. -- 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 -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi
2007-Dec-27 09:26 UTC
Re: How can i save the response from the net/http post?
getElementsByTagName("RESULT") getElementsByTagName() is the java script methos which does thye same work but not sure hoe to use with rails... -- 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 -~----------~----~----~----~------~----~------~--~---
Vidya Ramachandren
2007-Dec-27 09:29 UTC
Re: How can i save the response from the net/http post?
Nic __ wrote:> this is the response from net/http post. > > <TEST><RESULT>SUCCESS</RESULT><BR> > <GUID>{70fd9072-2886-4491-b968-b83396c3e24a}</GUID><BR> > <SPLITS>1</SPLITS></TEST> > > how can i split RESULT, GUID & SPLITS, so that i can save the value in > the database.You can try doing something like this: mystring = "This is a sample code" substring = "sample" start_ss = mystring.index(substring) mystring[start_ss, substring.length] -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Dec-27 10:25 UTC
Re: How can i save the response from the net/http post?
On 27 Dec 2007, at 08:47, Nic __ wrote:> > this is the response from net/http post. > > <TEST><RESULT>SUCCESS</RESULT><BR> > <GUID>{70fd9072-2886-4491-b968-b83396c3e24a}</GUID><BR> > <SPLITS>1</SPLITS></TEST> >Bung it into a parser like hpricot? or if it''s never gone to change much beyond that then munge it by hand with a few regexps Fred> how can i split RESULT, GUID & SPLITS, so that i can save the value in > the database. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 27 Dec 2007, at 08:47, Nic __ wrote: > >> >> this is the response from net/http post. >> >> <TEST><RESULT>SUCCESS</RESULT><BR> >> <GUID>{70fd9072-2886-4491-b968-b83396c3e24a}</GUID><BR> >> <SPLITS>1</SPLITS></TEST> >> > > Bung it into a parser like hpricot? or if it''s never gone to change > much beyond that then munge it by hand with a few regexps > > Fredthanks everyone, i think fred''s regexps is the way to go. i have been testing using split and gsub but still dont quite get it right. i just need to get value inside <RESULT></RESULT>, <GUID></GUID> & <SPLITS></SPLITS> and then save those values to database. can anyone provide code for gsub/split? -- 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 -~----------~----~----~----~------~----~------~--~---
Jeremy McAnally
2007-Dec-28 07:31 UTC
Re: How can i save the response from the net/http post?
To pull from the RESULT tags... result.match(/<RESULT>(.*)<\/RESULT>/)[1] You can modify it for the others. :) --Jeremy On Dec 28, 2007 2:25 AM, Nic __ <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Frederick Cheung wrote: > > On 27 Dec 2007, at 08:47, Nic __ wrote: > > > >> > >> this is the response from net/http post. > >> > >> <TEST><RESULT>SUCCESS</RESULT><BR> > >> <GUID>{70fd9072-2886-4491-b968-b83396c3e24a}</GUID><BR> > >> <SPLITS>1</SPLITS></TEST> > >> > > > > Bung it into a parser like hpricot? or if it''s never gone to change > > much beyond that then munge it by hand with a few regexps > > > > Fred > > thanks everyone, i think fred''s regexps is the way to go. > i have been testing using split and gsub but still dont quite get it > right. > i just need to get value inside <RESULT></RESULT>, <GUID></GUID> & > <SPLITS></SPLITS> and then save those values to database. > can anyone provide code for gsub/split? > > -- > Posted via http://www.ruby-forum.com/. > > > >-- http://www.jeremymcanally.com/ My books: Ruby in Practice http://www.manning.com/mcanally/ My free Ruby e-book http://www.humblelittlerubybook.com/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.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 -~----------~----~----~----~------~----~------~--~---
Fernando Perez
2008-Apr-22 15:15 UTC
Re: How can i save the response from the net/http post?
Hi, I am trying to post data to a remote webiste, and I''d like to be able to process its answer, how do I do that using net/http? -- 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 -~----------~----~----~----~------~----~------~--~---