F
F
Flie2015-01-14 11:16:18
PHP
Flie, 2015-01-14 11:16:18

How to display the entire POST request including headers and body using php?

Hey!
I have one application that sends a POST request to a server. Access is only to the code of this server and you need to find out what this request looks like and what it is. So far, I only know that there are some headers and some data in base64. Somewhere I saw a php function that can output the entire request as a string, but I can’t find it. Help pliz who than can!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
egor_nullptr, 2015-01-14
@egor_nullptr

php.net/manual/en/function.http-get-request-headers.php
php.net/manual/en/function.http-get-request-body.php

F
frees2, 2015-01-14
@frees2

$query_string = "";
if ($_POST) {  $kv = array();
foreach ($_POST as $key => $value) { $kv[] = "$key=$value"; }
$query_string = join("&", $kv);}
else { $query_string = $_SERVER['QUERY_STRING'];}



echo $query_string;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question