GitHunt
HE

hericklr/parse-raw-http-request

Analyzes the raw data received using the verb PUT and treats it to function as POST (including, especially, the attached files)

Parse raw HTTP request

PHP version Software License

Version 1.0.0

Analyzes the raw data received using the verb PUT and treats it to function as POST (including, especially, the attached files)

Features

  • expansion of field names with square brackets to multi-dimensional array
  • extraction of any attached files and writing to the temporary folder until the execution of the script is complete (with automatic removal at the end)
  • construction of the same data structure with details about each file received (name, type, tmp_name, error and size)
  • automatic scope execution and removal
  • currently supports the verbs get, post, put and delete
  • keeps the usual superglobal variables untouched ($_GET, $_POST and $_FILES)

Usage

Just import the file at the beginning of the script that should receive the form data

<?php

	require 'parse_raw_http_request.php';

	trigger_error(print_r($_GET,true));
	trigger_error(print_r($_POST,true));
	trigger_error(print_r($_PUT,true));
	trigger_error(print_r($_DELETE,true));
	trigger_error(print_r($_FILES,true));

// ...

There is a complete example in the "test" folder

Contributing

Feel free to submit any contributions

Author

Herick Ribeiro

Donations

Donations are more than welcome
If you like my work or encourage development, please, use the link below

paypal

Languages

PHP45.8%HTML39.3%CSS7.5%JavaScript7.5%

Contributors

Created March 25, 2020
Updated June 8, 2025
hericklr/parse-raw-http-request | GitHunt