# Net::HTTP.post\_form issue

**URL:** <https://www.ruby-forum.com/t/net-http-post-form-issue/88182>\
**Category:** Ruby\
**Created:** [March 8, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/net-http-post-form-issue/88182 "2007-03-08T19:45:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![coosa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@coosa](https://www.ruby-forum.com/u/coosa)\
**Post date:** [March 8, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/net-http-post-form-issue/88182/1 "2007-03-08T19:45:49Z")

</div>

Dear all,

I’m a newbie and have been looking for a solution regarding the  
following issue:  
I’m trying to get the results from the page  
[http://daftarj.spr.gov.my/daftarbi.asp](http://daftarj.spr.gov.my/daftarbi.asp) and looking at the source of  
the  
page I have the following information:

. . . . . There is no query string such as ...asp?id=blabla&something=blabla, so I need to simply pass the value I wish to post such as "0000059" into that hidden field and get the results bypassing the click on the button! Is this possible? I have tried a simple code and What didn't work is that it's not displaying the results based on the query as if it didn't submit the id for the hidden field in the input form!:

require ‘net/http’  
require ‘uri’  
res = Net::HTTP.post\_form URI.parse(‘[http://daftarj.spr.gov.my/](http://daftarj.spr.gov.my/)  
daftarbi.asp’),{“txtSub” =\> “0000059”}  
case res  
when Net::HTTPSuccess, Net::HTTPRedirection  
puts res.body  
else  
res.error!  
end

Kindly correct me If I’m wrong

Appreciate any help

regards

---

<div class="post-metadata">

**Author:** ![coosa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@coosa](https://www.ruby-forum.com/u/coosa)\
**Post date:** [March 8, 2007, 10:06pm UTC](https://www.ruby-forum.com/t/net-http-post-form-issue/88182/2 "2007-03-08T22:06:10Z")

</div>

On Mar 9, 2:41 am, “coosa” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> .  
> hidden field and get the results bypassing the click on the button!  
> Is this possible? I have tried a simple code and What didn’t work is  
> that it’s not displaying the results based on the  
> query as if it didn’t submit the id for the hidden field in the input  
> form!:
> 
> require ‘net/http’  
> require ‘uri’  
> res = Net::HTTP.post\_form URI.parse(‘[http://daftarj.spr.gov.my/](http://daftarj.spr.gov.my/)  
> daftarbi.asp’),{“txtSub” =\> “0000059”}  
> [snippet]  
> I have also tried on “txtIC” instead of “txtSub” and both don’t  
> display the resulst; is it perhaps because the POST called the  
> javascript function “Submitted()”?  
> [/snippet]
