Re: $_POST, $_GET and $_REQUEST discarding duplicates [message #170819 is a reply to message #170809] |
Mon, 29 November 2010 05:43 |
Jeff North
Messages: 58 Registered: November 2010
Karma:
|
Member |
|
|
On Sun, 28 Nov 2010 08:55:34 -0800 (PST), in comp.lang.php James
<starritt(at)gmail(dot)com>
<09c3a650-a28b-4a14-8b73-5feeb8e2ed38(at)p7g2000prb(dot)googlegroups(dot)com>
wrote:
> | > >When i tested, i got the following response:
> | >
> | > >test.php?a=12&a=12
> | >
> | > >response:
> | > >array(1) { ["a"]=> string(2) "12" }
> | >
> | > >so, OP seems to be right that the second parameter gets dropped.
> | >
> | > No.
> | >
> | > >but when i test with:
> | > >test.php?a=12&a=13
> | >
> | > >i get:
> | >
> | > >array(1) { ["a"]=> string(2) "13" }
> | >
> | > >so, in fact it looks more like the last parameters survives....
> | >
> | > Correct, because the second value overrides the first one. If you want
> | > to receive both in your script, make them an array with the syntax
> | > already mentioned.
> | >
> | > Micha
> |
> | It seems to be inconsistent across versions now testing it. Either
> | way I have no control over what comes in -- this is a OAI-PMH
> | repository (http://www.openarchives.org/OAI/openarchivesprotocol.html)
> | - I have no control over the harvesting services, forms or any HTML -
> | I don't get into any of that. All I can do is try and make sure that
> | the input I receive is valid and that I move forwards from there. I
> | doubt any HTML forms are used anywhere in this process, its either
> | query strings, or post via applications written in Pearl, C etc etc
> | and I have no control over poorly written harvesters.
> |
> |
> | oaipmh.php?verb=Identify (this is entirely valid.)
> | oaipmh.php?verb=Identify&verb=ListMetadataFormats (Invalid)
> | oaipmh.php?verb=Identify&verb=Invalid (Invalid)
> |
> | The latter two seem impossible to catch via $_POST, $_GET and
> | $_REQUEST ... given that I have no form control.
> |
> | Just trying to make things perfect here, as this is part of the
> | validation tests. I am going to pass the query strings our manually,
> | and interrogate the raw post data I think.
You can always use $_SERVER['QUERY_STRING'] to grab the info (for GET
data anyway). The problem is that you will need to do the parsing of
the string yourself. Not too hard to do. I think the php site even has
code to do this.
|
|
|