form method=post --> what are the query parameters in the url ?

B

bauhaus

I have a html page containing this form:

<form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>

When I load the html page in my browser and press the submit button, it
downloads a nzb file.

But how can I execute it directly from the url without pressing the submit
button, what are the parameters ?

I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I get
the error: no parameters.

Any suggestions ?
 
R

rf

bauhaus said:
I have a html page containing this form:

<form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>

When I load the html page in my browser and press the submit button,
it downloads a nzb file.

But how can I execute it directly from the url without pressing the
submit button, what are the parameters ?

I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then
I get the error: no parameters.

The server side script is *expecting* method=post.
 
L

Lars Eighner

the lovely and said:
I have a html page containing this form:
<form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>
When I load the html page in my browser and press the submit button, it
downloads a nzb file.
But how can I execute it directly from the url without pressing the submit
button, what are the parameters ?

You really need to get a basic understanding of the difference between
GET and POST. You cannot fake POST in the url.
I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I get
the error: no parameters.

Because the method is POST, not GET.
 
H

Harlan Messinger

bauhaus said:
I have a html page containing this form:

<form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>

When I load the html page in my browser and press the submit button, it
downloads a nzb file.

But how can I execute it directly from the url without pressing the
submit button, what are the parameters ?

I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I
get the error: no parameters.

Any suggestions ?

For that to work, the program nzb.fcgi has to check both the URL and the
body of the request to see if the expected parameters are present. If it
only checks the body of the request (which is where form control names
and values are placed), then you can't fake the form with URL parameters.
 
A

Andy

Harlan Messinger said:
For that to work, the program nzb.fcgi has to check both the URL and the
body of the request to see if the expected parameters are present. If it
only checks the body of the request (which is where form control names and
values are placed), then you can't fake the form with URL parameters.


This will work provided the user isn't one of those paranoid types that turn
off JavaScript...

<html>
<head>

<script language="JavaScript" type="text/JavaScript">
<!-- AUTO-SUBMIT FORM
function submit_form(){
document.myform.submit();
}
// - End of JavaScript - -->
</script>

</head>
<body onload="submit_form();">

<form name="myform" method="post"
action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>

</body>
</html>


Hope this helps

Andy
 
B

bauhaus

For that to work, the program nzb.fcgi has to check both the URL and the
body of the request to see if the expected parameters are present. If it
only checks the body of the request (which is where form control names and
values are placed), then you can't fake the form with URL parameters.

So what you're saying is that it all depends on the kind of script, some use
the url and others don't ?
Ok, that makes sense.
 
B

bauhaus

Because the method is POST, not GET.

Thats whats confusing me.
I have another similar example:

<form name="top" action="?m=gen" method="POST">
<input type="submit" value="Get NZB" name="getnzb">
<input type="hidden" name="p" value="244416">
<input type="hidden" name="mode" value="usenet">
<input type="hidden" name="offset" value="0">
<input type="hidden" name="type" value="">
<input type="hidden" name="group" value="">
<input type="hidden" name="q" value="">
<input type="hidden" name="age" value="200">
<input type="hidden" name="get" value="0">
</form>

Now, when I try this:
http://www.newzleech.com/?m=gen&get...roup=&q=&age=&get=0&offset=0&binary[]=1001917

It DOES download the file....

So whats the difference between this example and the previous one ?
 
B

bauhaus

This will work provided the user isn't one of those paranoid types that
turn off JavaScript...

<html>
<head>

<script language="JavaScript" type="text/JavaScript">
<!-- AUTO-SUBMIT FORM
function submit_form(){
document.myform.submit();
}
// - End of JavaScript - -->
</script>

</head>
<body onload="submit_form();">

<form name="myform" method="post"
action="http://binsearch.info/fcgi/nzb.fcgi">
<input name="action" value="nzb">
<input value="NZB" type="submit">
</form>

</body>
</html>

Thanks Andy, works like a charm !
 
R

rf

bauhaus said:
Because the method is POST, not GET.

Thats whats confusing me.
I have another similar example:

<form name="top" action="?m=gen" method="POST">
<input type="submit" value="Get NZB" name="getnzb">
<input type="hidden" name="p" value="244416">
<input type="hidden" name="mode" value="usenet">
<input type="hidden" name="offset" value="0">
<input type="hidden" name="type" value="">
<input type="hidden" name="group" value="">
<input type="hidden" name="q" value="">
<input type="hidden" name="age" value="200">
<input type="hidden" name="get" value="0">
</form>

Now, when I try this:
http://www.newzleech.com/?m=gen&get...roup=&q=&age=&get=0&offset=0&binary[]=1001917

It DOES download the file....

So whats the difference between this example and the previous one ?

You snipped the most important bit from Lars's post:

There is get and there is post. It is up to the server side process to look
for post of get or either. Some do both. Some do get. Some do post.

Your first example obvously contacted a server side process that only
accepted post.

You current example obvously contacted a server side process that accepted
either.

A server side process that looks for get will parse the URL it is given to
obtain the get parameters (the bit following the ? in the URL);

A server side process that looks for post will delve into the request
headers to obtain the post parameters.
 
N

Neredbojias

Because the method is POST, not GET.

Thats whats confusing me.
I have another similar example:

<form name="top" action="?m=gen" method="POST">
<input type="submit" value="Get NZB" name="getnzb">
<input type="hidden" name="p" value="244416">
<input type="hidden" name="mode" value="usenet">
<input type="hidden" name="offset" value="0">
<input type="hidden" name="type" value="">
<input type="hidden" name="group" value="">
<input type="hidden" name="q" value="">
<input type="hidden" name="age" value="200">
<input type="hidden" name="get" value="0">
</form>

Now, when I try this:
http://www.newzleech.com/?m=gen&getnzb=Get NZB&p=244416&mode=usenet&
type=&group=&q=&age=&get=0&offset=0&binary[]=1001917

It DOES download the file....

So whats the difference between this example and the previous one ?

Typically, server side scripts treat post variables separate from get
variables which means (for example) substituting GET p for POST p will
leave POST p null.
 
J

Jan Faerber

Here you could add:

setTimeout("self.close()", 1000);
}

// - End of JavaScript - -->

Couldn't u?
 
L

Lars Eighner

So what you're saying is that it all depends on the kind of script, some
use the url and others don't ?

Why don't you crack a book? --- that's what we are saying.

You cannot fake the POST method with the request string in the url. There
are a number of good reasons to prefer either POST or GET in certain
situations. One --- just one --- of the reasons to prefer POST is that it
prevents someone from linking or bookmarking to something in the middle of a
series of forms which need to be completed in sequence.

In some simple situations, the choice between POST and GET is arbitrary.
Since just about every server that can run a script will make will make the
full url string available in the script's environment, the author of a
script that should expect POST data can choose accidentally or on purpose
to parse the url string. This might be done on purpose for testing. It
might be done accidentally because the author does not know how to look for
POST data specifically or forgot to change things after testing. Since the
script might be fixed at any time, a link or bookmark that works today may
fail tomorrow.
 
M

Mariana Delbue

Why don't you crack a book?  --- that's what we are saying.

You cannot fake the POST method with the request string in the url.  There
are a number of good reasons to prefer either POST or GET in certain
situations.  One --- just one --- of the reasons to prefer POST is that it
prevents someone from linking or bookmarking to something in the middle of a
series of forms which need to be completed in sequence.

In some simple situations, the choice between POST and GET is arbitrary.
Since just about every server that can run a script will make will make the
full url string available in the script's environment, the author of a
script that should expect POST data can choose accidentally or on purpose
to parse the url string.  This might be done on purpose for testing.  It
might be done accidentally because the author does not know how to look for
POST data specifically or forgot to change things after testing.  Since the
script might be fixed at any time, a link or bookmark that works today may
fail tomorrow.




I am a TOTAL newbie to HTML, though I'm pretty good at Flash 2 & 3.

I need to pass a value (the user name) to an HTML page that is the
menu for a group of Flash games.

So, the HTML page nees to receive a string, and then pass it on when
it calls the game selected by the user.

I call the HTML page from Flash using (having set the user name
before)

getURL("http://Thegames.com/index2.html","_self","GET").... (I think
I'd prefer to use POST so the name doesn't show in the browser window,
but this is only a field test, so I can get away with it).

and the value of user name appears in the browser window, so the
flash command is sending it properly.

So how can I pass it on when I call one of the games using

<a href="Protected/menuSP.html"> /a> ?

Can you send me a code example that can be 1. called with a value in
POST 2. send on that value when it does an <a href?

Thank you very much,

Mariana

(I was planning to do my whole games site in Flash, but found out you
cannot mix AS2 & AS3 in one .swf file, and I have a lot of work
invested in both.....)
 
R

rf

Mariana said:
On Mar 26, 5:16 pm, Lars Eighner <[email protected]> wrote:

I am a TOTAL newbie to HTML, though I'm pretty good at Flash 2 & 3.

Yes, but who are you? You seem to have suddenly appeared in this thread with
I need to pass a value (the user name) to an HTML page that is the
menu for a group of Flash games.

So, the HTML page nees to receive a string, and then pass it on when
it calls the game selected by the user.

I call the HTML page from Flash using (having set the user name
before)

OK so far.
getURL("http://Thegames.com/index2.html","_self","GET").... (I think
I'd prefer to use POST so the name doesn't show in the browser window,
but this is only a field test, so I can get away with it).

This is where you start to fall down. It is not up to you to choose if you
use get or post. It is the server side script (or whatever) that dictates
which you use. All of this has been covered already in this thread.
and the value of user name appears in the browser window, so the
flash command is sending it properly.
Er...

So how can I pass it on when I call one of the games using

<a href="Protected/menuSP.html"> /a> ?

See above.
Can you send me a code example that can be 1. called with a value in
POST 2. send on that value when it does an <a href?

Nobody can send you such code because it simply can not be done. A <a> link
can not send post data. If you really want to do this then you must
investigate javascript which can intercept the onclick event on the <a>
element and then investigate XMLHpptRequest which *can* send post data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top