Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to replace $GLOBALS['HTTP_RAW_POST_DATA'] in php 7?

Tags:

php

php-7

$HTTP_RAW_POST_DATA is removed in PHP 7.0. In my application, I also have the following line. What is the alternative I can use for this ?

if (isset($GLOBALS['HTTP_RAW_POST_DATA']) && 
                                  mb_strlen($GLOBALS['HTTP_RAW_POST_DATA']))
like image 611
Shankar Avatar asked Dec 23 '22 00:12

Shankar


1 Answers

According to the manual:

In general, php://input should be used instead of $HTTP_RAW_POST_DATA

To get the Raw Post Data:

<?php $postdata = file_get_contents("php://input"); ?>
like image 150
Michaël Hompus Avatar answered Dec 30 '22 19:12

Michaël Hompus