Building RESTful web services, like other programming skills is part art, part science. As the Internet industry progresses, creating a REST API becomes more concrete with emerging best practices. As RESTful web services don’t follow a prescribed standard except for HTTP, it’s important to build your RESTful API in accordance with industry best practices to ease development and increase client adoption.
Presently, there aren’t a lot of REST API guides to help the lonely developer. RestApiTutorial.com is dedicated to tracking REST API best practices and making resources available to enable quick reference and self education for the development crafts-person. We’ll discuss both the art and science of creating REST Web services.
—Todd Fredrich, The REST API Tutor
$content = file_get_contents(“php://input”); // get the JSON Content
//You only need this one line actually.
//From here onwards, you may process the data – putting into database, or write into text file
var_dump(json_decode($content)); // if you want to show the data
$file = fopen(“test.txt”,”w”); //in this case, I put the data into a text file.