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

**URL:** <https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280>\
**Category:** Rails\
**Created:** [December 27, 2007, 9:47am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280 "2007-12-27T09:47:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 27, 2007, 9:47am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/1 "2007-12-27T09:47:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 27, 2007, 10:29am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/2 "2007-12-27T10:29:44Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 27, 2007, 10:26am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/3 "2007-12-27T10:26:28Z")

</div>

getElementsByTagName(“RESULT”)

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

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 27, 2007, 11:26am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/4 "2007-12-27T11:26:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 28, 2007, 8:25am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/5 "2007-12-28T08:25:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [December 28, 2007, 8:31am UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/6 "2007-12-28T08:31:57Z")

</div>

To pull from the RESULT tags…

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

You can modify it for the others. 🙂

–Jeremy

On Dec 28, 2007 2:25 AM, Nic \_\_ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > >
> 
> and then save those values to database.  
> can anyone provide code for gsub/split?
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
[http://www.jeremymcanally.com/](http://www.jeremymcanally.com/)

My books:  
Ruby in Practice

> **[Ruby in Practice](https://www.manning.com/books/ruby-in-practice)**
>
> Like Ruby itself, Ruby in Practice will make you more productive. The book shows you practical techniques and strategies for small projects and large-scale environments. A cookbook-style reference, it gives you concrete examples of systems...

My free Ruby e-book

> **[Site not found · DreamHost](http://www.humblelittlerubybook.com/)**
>
> The owner of this domain has not yet uploaded their website.

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![nobobyhere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@nobobyhere](https://www.ruby-forum.com/u/nobobyhere)\
**Post date:** [April 22, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/how-can-i-save-the-response-from-the-net-http-post/124280/7 "2008-04-22T17:15:35Z")

</div>

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?
