Created
May 18, 2019 09:16
-
-
Save stephenreay/2dc75d4042c261ee790fa0ead98f8785 to your computer and use it in GitHub Desktop.
HTTPie mangles input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php -S 127.0.0.1:8888 index.php > php.log 2>&1 & | |
curl 127.0.0.1:8888 -d foo=bar > curl.out 2>&1 | |
http POST 127.0.0.1:8888 foo=bar > httpie.out 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 | |
100 133 0 126 100 7 183k 10416 --:--:-- --:--:-- --:--:-- 123k | |
Method: | |
string(4) "POST" | |
Get: | |
array(0) { | |
} | |
POST: | |
array(1) { | |
["foo"]=> | |
string(3) "bar" | |
} | |
Raw POST: | |
string(7) "foo=bar" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Method: | |
string(4) "POST" | |
Get: | |
array(0) { | |
} | |
POST: | |
array(0) { | |
} | |
Raw POST: | |
string(14) "{"foo": "bar"}" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Method:' . PHP_EOL; | |
var_dump($_SERVER['REQUEST_METHOD']); | |
echo PHP_EOL; | |
echo 'Get:'.PHP_EOL; | |
var_dump($_GET); | |
echo PHP_EOL; | |
echo 'POST:' .PHP_EOL; | |
var_dump($_POST); | |
echo PHP_EOL; | |
echo 'Raw POST:' . PHP_EOL; | |
var_dump(file_get_contents('php://input')); | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment