Search code examples
phpjsonapipostmanform-data

post files from postman to PHP


I'm trying to send some data from postman to server but PHP always return null, PHP only gets the data when I send it using raw body.

postman form-data

PHP Code:

<?php

  require_once("_config.php");

  if($_SERVER['PHP_AUTH_USER'] == AUTH_USER && $_SERVER['PHP_AUTH_PW'] == AUTH_PW){

    $data = file_get_contents("php://input");
    echo $data;
  }

?>

Solution

  • Okay guys, I solved it by removing one of postman headers. I removed Content-Type.

    postman Content-Type header