Answers for "@file_get_contents json_decode php"

PHP
7

php decode json file

$json = json_decode(file_get_contents('/path/to/your/file.json'));
Posted by: Guest on March-15-2020
0

json_decode(file_get_contents('php //input') true) null

if($_SERVER["REQUEST_METHOD"] == "POST" && $_SERVER["CONTENT_TYPE"] == "application/json")
{
  $data = file_get_contents("php://input", false, stream_context_get_default(), 0, $_SERVER["CONTENT_LENGTH"]);
  global $_POST_JSON;
  $_POST_JSON = json_decode($_REQUEST["JSON_RAW"],true);

  // merge JSON-Content to $_REQUEST 
  if(is_array($_POST_JSON)) $_REQUEST   = $_POST_JSON+$_REQUEST;
}
Posted by: Guest on July-22-2021

Browse Popular Code Answers by Language