Shankar
Shankar

Reputation: 133

What to replace $GLOBALS['HTTP_RAW_POST_DATA'] in 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']))

Upvotes: 5

Views: 4004

Answers (1)

Michaël Hompus
Michaël Hompus

Reputation: 3479

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"); ?>

Upvotes: 11

Related Questions