Forum: Ruby post_form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Coosa A. (Guest)
on 2007-03-08 09:13
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 and looking at the source of the
page I have the following information:

<form method="post" name="def" action="daftarbi.asp">
.
.
.
<INPUT name="txtIC" maxlength="12"><Input type=hidden name="txtSub">
.
.
</form>
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?
Is this possible? I have tried a simple code and it didn't work:

require 'net/http'
require 'uri'
res = Net::HTTP.post_form
URI.parse('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
Coosa A. (Guest)
on 2007-03-08 09:25
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!
Coosa A. (Guest)
on 2007-03-08 23:45
Coosa Aa wrote:
> 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!

It's not displaying the results; there is a button in the page and when
clicked, a JavaScript function "submitted()" is called. Now the response
is OK, but I get no results as expected; I appreciate you try going to
the link I provided.
Simply I don't know how to call the Javascript function within my Ruby
code.

regards
Coosa A. (Guest)
on 2007-03-08 23:48
Coosa Aa wrote:
> Coosa Aa wrote:
>> 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!
>
> It's not displaying the results; there is a button in the page and when
> clicked, a JavaScript function "submitted()" is called. Now the response
> is OK, but I get no results as expected; I appreciate you try going to
> the link I provided.
> Simply I don't know how to call the Javascript function within my Ruby
> code.
>
> regards

Inside the form (Though it would be helpful):
<INPUT name="txtIC" maxlength="12"><Input type=hidden name="txtSub">
<INPUT type="button" name="Check" value="Check" onclick="submitted()">

I called once in my Ruby Code:
URI.parse('http://daftarj.spr.gov.my/daftarbi.asp'),{"txtSub"... =>
"0000059"}
and once:
URI.parse('http://daftarj.spr.gov.my/daftarbi.asp'),{"txtIC"... =>
"0000059"}
but it never showed the results either way.
Austin Z. (Guest)
on 2007-03-08 23:49
(Received via mailing list)
On 3/8/07, Coosa Aa <removed_email_address@domain.invalid> wrote:
> Coosa Aa wrote:
> > 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!
> It's not displaying the results; there is a button in the page and when
> clicked, a JavaScript function "submitted()" is called. Now the response
> is OK, but I get no results as expected; I appreciate you try going to
> the link I provided.
> Simply I don't know how to call the Javascript function within my Ruby
> code.

You probably want to ask this on the Rails forum. This is the general
Ruby mailing list, mirrored to ruby-forum.com.

-austin
Austin Z. (Guest)
on 2007-03-08 23:52
(Received via mailing list)
On 3/8/07, Austin Z. <removed_email_address@domain.invalid> wrote:
> You probably want to ask this on the Rails forum. This is the general
> Ruby mailing list, mirrored to ruby-forum.com.

I was wrong. This is the right place; I just don't know the answer and
I shouldn't post when I'm too busy to read in detail. Sorry, Coosa.

-austin
Coosa A. (Guest)
on 2007-03-08 23:53
Austin Z. wrote:
> On 3/8/07, Coosa Aa <removed_email_address@domain.invalid> wrote:
>> Coosa Aa wrote:
>> > 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!
>> It's not displaying the results; there is a button in the page and when
>> clicked, a JavaScript function "submitted()" is called. Now the response
>> is OK, but I get no results as expected; I appreciate you try going to
>> the link I provided.
>> Simply I don't know how to call the Javascript function within my Ruby
>> code.
>
> You probably want to ask this on the Rails forum. This is the general
> Ruby mailing list, mirrored to ruby-forum.com.
>
> -austin

I'm not using Rails at all,
The Net::HTTP.post_form is a core Ruby library and i'm just using a
simple Ruby code in a *.rb file
Pit C. (Guest)
on 2007-03-09 10:37
(Received via mailing list)
Coosa Aa schrieb:
>> (...) I appreciate you try going to the link I provided.

The page says "ELECTION COMISSION OF MALAYSIA, ELECTORS ROLL CHECKING".
Can you tell me what this page is about and what you are trying to do?

Regards,
Pit
Coosa A. (Guest)
on 2007-03-10 02:20
Pit C. wrote:
> Coosa Aa schrieb:
>>> (...) I appreciate you try going to the link I provided.
>
> The page says "ELECTION COMISSION OF MALAYSIA, ELECTORS ROLL CHECKING".
> Can you tell me what this page is about and what you are trying to do?
>
> Regards,
> Pit
The problem is solved by modifing the line into:
URI.parse('http://daftarj.spr.gov.my/daftarbi.asp'),{"txtIC"... =>
"0000059", "txtSub" => "Submitted"}
The JavaScript function already cleared but I overlooked it!
But for your comment, watch what you write and don't judge and forget
that the page is publically accessible; so I don't post here to get such
comments and I that question of yours doesn't deserve a response!

Regards
Pit C. (Guest)
on 2007-03-10 21:28
(Received via mailing list)
Coosa Aa schrieb:
> Pit C. wrote:
>> The page says "ELECTION COMISSION OF MALAYSIA, ELECTORS ROLL CHECKING".
>> Can you tell me what this page is about and what you are trying to do?
>>
> But for your comment, watch what you write and don't judge and forget
> that the page is publically accessible; so I don't post here to get such
> comments and I that question of yours doesn't deserve a response!

Hi Coosa Aa. Yes, it's a public site. But when I entered the data you've
mentioned, the response looked like personal data to me. Since I don't
know the language spoken in Malaysia, I wasn't sure about that. That's
why I asked you my question. Now, interpreting your answer, I think I
was right that it's possible to get at personal data by entering the
right numbers. If this is not what you're after, I apologize. It seems
you found at least one part of the answer to your question, so I guess I
don't have to show you my solution.

Regards,
Pit
Coosa A. (Guest)
on 2007-03-11 04:17
Pit C. wrote:
> Coosa Aa schrieb:
>> Pit C. wrote:
>>> The page says "ELECTION COMISSION OF MALAYSIA, ELECTORS ROLL CHECKING".
>>> Can you tell me what this page is about and what you are trying to do?
>>>
>> But for your comment, watch what you write and don't judge and forget
>> that the page is publically accessible; so I don't post here to get such
>> comments and I that question of yours doesn't deserve a response!
>
> Hi Coosa Aa. Yes, it's a public site. But when I entered the data you've
> mentioned, the response looked like personal data to me. Since I don't
> know the language spoken in Malaysia, I wasn't sure about that. That's
> why I asked you my question. Now, interpreting your answer, I think I
> was right that it's possible to get at personal data by entering the
> right numbers. If this is not what you're after, I apologize. It seems
> you found at least one part of the answer to your question, so I guess I
> don't have to show you my solution.
>
> Regards,
> Pit

Such childish plays; we're here in a professional forum, so be one. I
even mentioned that I solved it, so don't even try to impress by
mentioning that you have an answer; I don't need it, I have it -
"txtSub" => "Submitted".
Coosa A. (Guest)
on 2007-03-11 07:22
Coosa Aa wrote:
> Pit C. wrote:
>> Coosa Aa schrieb:
>>> Pit C. wrote:
>>>> The page says "ELECTION COMISSION OF MALAYSIA, ELECTORS ROLL CHECKING".
>>>> Can you tell me what this page is about and what you are trying to do?
>>>>
>>> But for your comment, watch what you write and don't judge and forget
>>> that the page is publically accessible; so I don't post here to get such
>>> comments and I that question of yours doesn't deserve a response!
>>
>> Hi Coosa Aa. Yes, it's a public site. But when I entered the data you've
>> mentioned, the response looked like personal data to me. Since I don't
>> know the language spoken in Malaysia, I wasn't sure about that. That's
>> why I asked you my question. Now, interpreting your answer, I think I
>> was right that it's possible to get at personal data by entering the
>> right numbers. If this is not what you're after, I apologize. It seems
>> you found at least one part of the answer to your question, so I guess I
>> don't have to show you my solution.
>>
>> Regards,
>> Pit
>
> Such childish plays; we're here in a professional forum, so be one. I
> even mentioned that I solved it, so don't even try to impress by
> mentioning that you have an answer; I don't need it, I have it -
> "txtSub" => "Submitted".

[Solved] A kind request for the admins to close the post.
Clearance: the question relates to a part of my "Final Year Project" in
the Multimedia University http://www.mmu.edu.my of the Faculty of IT, to
create an online e-voting system in Malaysia; silly childish questions
attempting to lecture me about morals are useless; any naive person
would obviously see that the page I provided has a "gov" domain and It's
annoying assuming I don't know that! If I'm stupid enough to attempt to
do some thing wrong, I would have obviously written a sample of a normal
page which uses the same pattern; It's the first time in a forum I see
such annoying people like "Pit".
No more replies to this post would be posted from my side.

Regards
This topic is locked and can not be replied to.