Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
>$HTTP_RAW_POST_DATA is an array... >with echo you'll only get "array".. No, it's a string - just the raw bytes that were posted. >> Is register globals ON or OFF? Either way, maybe try >> $_SERVER['HTTP_RAW_POST_DATA']... Also, ensure that "always_populate_raw_post_data" is on, too - see: http://www.php.net/manual/en/configuration.directives.php - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
Your script should work fine, and to fix claims made in this thread: a) $HTTP_RAW_POST_DATA is NOT an array, it's a string. b) It does not live in $_SERVER, or rely on register_globals. Your code is wrong because you don't provide names for your fields, so there is no POST data. Assign your text field a name, and your submit field a name, and it will work. Also, keep in mind that $PHP_SELF existing requires the PHP directive register_globals to be on. Regards, Philip p.s. On Fri, 1 Aug 2003, Balazs Halasy wrote: > I need to have the contents of $HTTP_RAW_POST_DATA because of > non-regular uploads (from browser to my home-made WevDAV server implementation > (done in PHP)). However, no matter what I > do, it is always NULL. I guess the following script should return > SOMETHING in $HTTP_RAW_POST DATA if "always_populate_raw_post_data = On" is > added to the php.ini file (and yes, I've restarted apache :-)... so, why > is it empty and how can I get the RAW post data? My PHP version is 4.3.2. > > test.php: > > > > > > echo("Raw post data: ".$HTTP_RAW_POST_DATA."\n"); > echo("Raw post data decoded: > ".base64_decode($HTTP_RAW_POST_DATA)."\n"); > echo(""); > phpinfo(); > ?> > > > > Allman > > > -- > 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
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]): > --- Curt Zirzow <[EMAIL PROTECTED]> wrote: > > Since print_r is usually used for debugging, it would be nice that > > php does this for you. Any comments on this before i throw the > > idea to the php-dev list? > > As of 4.3.0, you can store the output of print_r() in a variable, so that > allows developers to do whatever they want. For example, you can apply > htmlentities() with something like the following: > > echo '' . htmlentities(print_r($_POST, 1)) . ''; hmmm.. that should work. I was kinda under the impression that print_r returns an array with that second paramter passed. > > Hope that helps. Thanks Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
* Thus wrote skate ([EMAIL PROTECTED]): > > Since print_r is usually used for debugging, it would be nice that > > php does this for you. Any comments on this before i throw the > > idea to the php-dev list? > > > > if it's just used for debugging, can't you just use the tags around > it? i mean, it's no big deal, and you don't really need it formatted to look > pretty. > > that's how i use it anyway... True, but the pre tags dont stop the browser from rendering html code. I dont have any problems wrapping "" around the print_r. $var = "" print_r($var); Yields an image not the actual string in $var. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
--- Curt Zirzow <[EMAIL PROTECTED]> wrote: > Since print_r is usually used for debugging, it would be nice that > php does this for you. Any comments on this before i throw the > idea to the php-dev list? As of 4.3.0, you can store the output of print_r() in a variable, so that allows developers to do whatever they want. For example, you can apply htmlentities() with something like the following: echo '' . htmlentities(print_r($_POST, 1)) . ''; Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
> Since print_r is usually used for debugging, it would be nice that > php does this for you. Any comments on this before i throw the > idea to the php-dev list? > if it's just used for debugging, can't you just use the tags around it? i mean, it's no big deal, and you don't really need it formatted to look pretty. that's how i use it anyway... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
* Thus wrote Donald Tyler ([EMAIL PROTECTED]): > > Also, print_r() does not include any HTML formatting, so you will need to > look at the source for the page in the browser to make it readable. This is a problem I run into all the time, I am curious of how many people have run into this. I've been considering writting a patch for php that will enable an option to htmlentity the strings. The alternative would be to write a function that loops through all the results: function my_print_r($var) { $r = print_r($var, true); foreach($var as $key => $val) { if (is_string($val) ) { $val = htmlentities($val); } elseif (is_array($val) { $val = my_print_r($val); } $r[$key] = $val; } return $r; } Since print_r is usually used for debugging, it would be nice that php does this for you. Any comments on this before i throw the idea to the php-dev list? Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
> Also, print_r() does not include any HTML formatting, so you will need to > look at the source for the page in the browser to make it readable. or your could use ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trouble getting $HTTP_RAW_POST_DATA
You should encase the $HTTP_RAW_POST_DATA in print_r() or you will just get the word "Array" printed. But I doubt that will solver your problem because it seems that $HTTP_RAW_POST_DATA is empty. Also, print_r() does not include any HTML formatting, so you will need to look at the source for the page in the browser to make it readable. -Original Message- From: Balazs Halasy [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 7:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Trouble getting $HTTP_RAW_POST_DATA I need to have the contents of $HTTP_RAW_POST_DATA because of non-regular uploads (from browser to my home-made WevDAV server implementation (done in PHP)). However, no matter what I do, it is always NULL. I guess the following script should return SOMETHING in $HTTP_RAW_POST DATA if "always_populate_raw_post_data = On" is added to the php.ini file (and yes, I've restarted apache :-)... so, why is it empty and how can I get the RAW post data? My PHP version is 4.3.2. test.php: \n"); echo("Raw post data decoded: ".base64_decode($HTTP_RAW_POST_DATA)."\n"); echo(""); phpinfo(); ?> Allman -- 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
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
Hi, $HTTP_RAW_POST_DATA is an array... with echo you'll only get "array".. To get something into $HTTP_RAW_POST_DATA, you need to "submit" your form before... Your script will only display something if you post the form before. Regards, P.E. Baroiller "John W. Holmes" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] > Balazs Halasy wrote: > > I need to have the contents of $HTTP_RAW_POST_DATA because of > > non-regular uploads (from browser to my home-made WevDAV server implementation > > (done in PHP)). However, no matter what I > > do, it is always NULL. I guess the following script should return > > SOMETHING in $HTTP_RAW_POST DATA if "always_populate_raw_post_data = On" is > > added to the php.ini file (and yes, I've restarted apache :-)... so, why > > is it empty and how can I get the RAW post data? My PHP version is 4.3.2. > > Is register globals ON or OFF? Either way, maybe try > $_SERVER['HTTP_RAW_POST_DATA']... > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > PHP|Architect: A magazine for PHP Professionals - www.phparch.com > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA
Balazs Halasy wrote: I need to have the contents of $HTTP_RAW_POST_DATA because of non-regular uploads (from browser to my home-made WevDAV server implementation (done in PHP)). However, no matter what I do, it is always NULL. I guess the following script should return SOMETHING in $HTTP_RAW_POST DATA if "always_populate_raw_post_data = On" is added to the php.ini file (and yes, I've restarted apache :-)... so, why is it empty and how can I get the RAW post data? My PHP version is 4.3.2. Is register globals ON or OFF? Either way, maybe try $_SERVER['HTTP_RAW_POST_DATA']... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php