3

first question on SO!

I am running a PHP 5.3.10 on apache 2.2.22. I am only doing this:

<html>
<body>
<?php
file_put_contents('php://stderr', print_r($_SERVER, TRUE));
?>
</body>
</html>

the output in Apache's error.log looks like:

Array
(
[HTTP_HOST] => dns1
[PATH] => /usr/local/bin:/usr/bin:/bin
[SERVER_SIGNATURE] => <address>Apache/2.2.22 (Ubuntu) Server at dns1 Port 80</address>

[SERVER_SOFTWARE] => Apache/2.2.22 (Ubuntu)
[SERVER_NAME] => dns1
[SERVER_ADDR] => 192.168.2.6
[SERVER_PORT] => 80
[REMOTE_ADDR] => 98.210.76.128
[DOCUMENT_ROOT] => /var/www
[SERVER_ADMIN] => webmaster@localhost
[SCRIPT_FILENAME] => /var/www/rcv.php
[REMOTE_PORT] => 51164
[GATEWAY_INTERFACE] => CGI/1.1
R5 HTTP/1.0_PROTOCOL] => R5000
[REQUEST_METHOD] => GET
[QUERY_STRING] => UID=3333&DATA=R5000
[REQUEST_URI] => /rcv.php/?UID=3333&DATA=R5000
[SCRIPT_NAME] => /rcv.php
[PATH_INFO] => /
[PATH_TRANSLATED] => /var/www/index.html
[PHP_SELF] => /rcv.php/
[REQUEST_TIME] => 1369084575
)

the incoming http request is of the form: (snippet from apache's access.log)

98.210.76.128 - - [20/May/2013:13:21:10 -0700] "GET /rcv.php/?UID=3333&DATA=R5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000\rR5000

(it's a series of sensor readings. They are all "R5000" in this case.)

The [QUERY_STRING] and [REQUEST_URI] seem to get truncated at the first carriage return (\r), causing me to lose the rest of the sensor readings. This is confirmed when I look at the $_GET values, only one sensor reading is present in the DATA field.

How can I avoid this or change this behavior?

2 Answers 2

3

You cannot send a carriage return to a GET request. Try Using Post instead

Sign up to request clarification or add additional context in comments.

Comments

3

Parameters and their values should be urlnecoded, so instead \r in your url, you should use %0D

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.