RE: [PHP] POST Query String
| From: | Samantha Savvakis | Date: | Thu, 20 Jun 2002 03:39:32 +0000 |
| Subject: | RE: [PHP] POST Query String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103068@lists.php.net to get a copy of this message | ||
HI,
$_SERVER["QUERY_STRING"] isn't being populated. I am thinking it is a GET
operation rather than POST.
To confirm all the server variables, this is how I am doing a test.
1. test.php - uses "curl" and posts to a web page and the data is "<?xml
version=1.0><LOGON><USERNAME>...</USERNAME><PASSWD>...</PASSWD></LOGON>"
cmd: curl -m 10 -d $data $URL -L -s
$data being the XML data
$URL being "receivexml.php"
I have also used the PHP API's for cURL and it produces the same result.
2. The page that test.php is posting to - I'm doing a phpinfo() and
capturing the output.
QUERY_STRING is never set I'm afraid. That was my first thought.
I thought about "glueing" together (as you say) the name and value - problem
is, the key is "<?xml_version". It put in the underscore. There would be
fiddling around I guess.
I'm thinking that I'm going to have to ask anyone who posts XML to any of my
sites to send the data in a name/value pair format. ie. STRXML=<?xml
version.....>.
Thanks,
Sam
> -----Original Message-----
> From: Justin French [mailto:justin@indent.com.au]
> Sent: Thursday, 20 June 2002 1:28 PM
> To: Samantha Savvakis; php-general@lists.php.net
> Subject: Re: [PHP] POST Query String
>
>
> I'm unsure if $_SERVER['QUERY_STRING'] is the combination of POST and GET,
> or just GET, or perhaps you need to run a few tests... shouldn't be hard.
>
> Failing that, you could glue all the $_POST vars back together,
> but I can't
> imagine why I'd ever need to do that.
>
> Something like (untested)
>
> <?
> $post_string = "";
>
> foreach($_POST as $key => $value)
> {
> if($post_string != "")
> {
> $post_string .= "&";
> }
> $post_string .= "{$key}={$value};
> }
>
> echo $post_string;
> ?>
>
> Not sure, but I think the code might need to be tweaked if you're
> expecting
> arrays as values of some $_POST values.
>
>
> Justin French
>
>
>
>
>
> on 20/06/02 1:10 PM, Samantha Savvakis (samantha@cfs.net.au) wrote:
>
> > Hi,
> >
> > Thanks for the reply.
> >
> > As I understand, $_POST is the new way of writing $HTTP_POST_VARS since
> > version 4.1.x or greater. If this is correct, at the stage where I have
> > $_POST, it has already parsed the incoming query string into name/value
> > pairs and put into the $_POST array.
> >
> > I am wanting the query string before it gets parsed into the
> name / value
> > pairs.
> >
> > Thanks,
> > Sam
> >
> > "Bruce Karstedt" <bkarstedt@prodigy.net> wrote in message
> > news:021201c21803$ffdce3b0$4773d73f@c3...
> >> Try "$_POST"
> >>
> >> Bruce Karstedt
> >> President
> >> Technology Consulting Associates, Ltd.
> >> Tel: 847-735-9488
> >> Fax: 847-735-9474
> >>
> >>
> >> -----Original Message-----
> >> From: Samantha Savvakis [mailto:samantha@cfs.net.au]
> >> Sent: Wednesday, June 19, 2002 8:28 PM
> >> To: php-general@lists.php.net
> >> Subject: Re: [PHP] POST Query String
> >>
> >>
> >> Hi Again,
> >>
> >> I just upgraded to version 4.2.0 and I have turned on
> >> "always_populate_raw_post_data" in the php.ini file.
> >>
> >> There is no "$HTTP_RAW_POST_DATA" variable after I post.
> >>
> >> I have got "Register_globals" turned "On".
> >>
> >> Sam
> >>
> >> "Philip Olson" <philip@cornado.com> wrote in message
> >>
> >> news:Pine.BSF.4.10.10206200003400.82649-100000@localhost...
> >>>
> >>> $HTTP_RAW_POST_DATA will exist if the PHP directive
> >>> always_populate_raw_post_data is on. This directive
> >>> works as of 4.2.0
> >>>
> >>> Regards,
> >>> Philip Olson
> >>>
> >>>
> >>> On Thu, 20 Jun 2002, Samantha Savvakis wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I was wondering if it's possible to retrieve the entire Posted string
> >> as 1
> >>>> string before it gets into $HTTP_POST_VARS array?
> >>>>
> >>>> For example - In ASP, I can go Request.QueryString and it will return
> > me
> >> the
> >>>> entire posted string , or I can index it to get a particular
> > Name/Value
> >> pair
> >>>> out.
> >>>>
> >>>> The reason for this is - we have an application where we are posting
> > XML
> >>>> data to web pages. There isn't a Name/Value pair as such. I am just
> >> posting
> >>>> pure XML data to a web page. When the receiving web page
> gets the data
> >> and I
> >>>> try to use $HTTP_POST_VARS, it tries to split the data into
> name value
> >>>> pairs, so I end up with
> >>>>
> >>>> Name: <?xml_version
> >>>> Value 1.0?><ELEMENT><...></ELEMENT>
> >>>>
> >>>> I would like it to just be 1 query string, rather than being parsed
> > into
> >> the
> >>>> HTTP_POST_VARS array. The Content-Type is going to be text/xml , and
> >> even if
> >>>> it wasn't and we used HTTP_RAW_POST_VARS, this server variable still
> >> acts
> >>>> the same was as HTTP_POST_VARS and tries to put the receiving data
> > into
> >> a
> >>>> name/value pair array.
> >>>>
> >>>> Is there a server variable at all that I can use? I have been looking
> >> around
> >>>> at all the available server variables but can't find anything that
> > will
> >> give
> >>>> me the entire posted string.
> >>>>
> >>>> Thanks,
> >>>> Sam
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> PHP General Mailing List (http://www.php.net/)
> >>>> To unsubscribe, visit:
> >>>> http://www.php.net/unsub.php
> >>>>
> >>>
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
>