WP_REST_Server::get_raw_data() public WP 4.4.0
Retrieves the raw request entity (body).
{} It's a method of the class: WP_REST_Server{}
No Hooks.
Return
String. Raw request data.
Usage
$result = WP_REST_Server::get_raw_data();
Notes
- Global. String. $HTTP_RAW_POST_DATA Raw post data.
Changelog
Since 4.4.0 | Introduced. |
Code of WP_REST_Server::get_raw_data() WP REST Server::get raw data WP 5.6
public static function get_raw_data() {
// phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
global $HTTP_RAW_POST_DATA;
// $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
}
return $HTTP_RAW_POST_DATA;
// phpcs:enable
}