It's basically a webservice for android developers. Below is the function made by me to get the input request from url.
function readInputStream() {
$return_array = array();
$body = @file_get_contents('php://input');
if(get_magic_quotes_gpc())
{
$body = stripslashes($body);
}
// check if body is compressed or not
if (strlen($body) < 18 || strcmp(substr($body,0,2),"\x1f\x8b"))
{
$body = $body;
}
else
{
$tbody = $this->gzdecode($body);
$body = $tbody;
}
if(!empty($body))
{
$return_array = json_decode($body, true);
}
return $return_array;
}
Now I want to combine post and file request
.
I know that php://input
will get all post requests.
But i want to include file request as well in this function.
$body = @file_get_contents('php://input');
So, how can I merge post and file requests in $body variable in the above function?
I tried to like this it's not working,
$body = @file_get_contents('php://input');
$body .= @file_get_contents('php://fd');
Also tried like,
$body = @file_get_contents('php://input');
$body .= $_FILES;