How can i save the response from the net/http post?

this is the response from net/http post.

SUCCESS

{70fd9072-2886-4491-b968-b83396c3e24a}

1

how can i split RESULT, GUID & SPLITS, so that i can save the value in
the database.

Nic __ wrote:

this is the response from net/http post.

SUCCESS

{70fd9072-2886-4491-b968-b83396c3e24a}

1

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]

getElementsByTagName(“RESULT”)

getElementsByTagName() is the java script methos which does thye same
work but not sure hoe to use with rails…

On 27 Dec 2007, at 08:47, Nic __ wrote:

this is the response from net/http post.

SUCCESS

{70fd9072-2886-4491-b968-b83396c3e24a}

1

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

Frederick C. wrote:

On 27 Dec 2007, at 08:47, Nic __ wrote:

this is the response from net/http post.

SUCCESS

{70fd9072-2886-4491-b968-b83396c3e24a}

1

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 , &
and then save those values to database.
can anyone provide code for gsub/split?

To pull from the RESULT tags…

result.match(/(.*)</RESULT>/)[1]

You can modify it for the others. :slight_smile:

–Jeremy

On Dec 28, 2007 2:25 AM, Nic __ [email protected]
wrote:

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

My free Ruby e-book
http://www.humblelittlerubybook.com/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs