Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function fetchData()
- {
- $inputText = file_get_contents("php://input");
- $userInputs = explode("&", $inputText);
- $data = array();
- foreach ($userInputs as $input) {
- $keyValue = explode("=", $input);
- $key = $keyValue[0];
- $value = $keyValue[1];
- $data[$key] = $value;
- }
- return $data;
- }
- $data = fetchData();
- $username = $data['username'];
- $password = $data['password'];
- header('Content-Type: application/json');
- echo json_encode($data);
- ?>
Add Comment
Please, Sign In to add comment