troubleshooting Question

php creating an api post problem

Avatar of derrida
derrida asked on
9 Comments2 Solutions330 ViewsLast Modified:
it is the first time i learn how to write an api. i have the folder structure of: apihub/v1/api.php

the GET part works: i get all the customers and a customer according to an id. i have issue with POST variables.

i read that instead of reading POST array one should use : file_get_contents("php://input")

so i have this code:
    $customer = json_decode(file_get_contents("php://input"));


and when i use the chrome extension i get NULL, but if i don't use the json_decode i so get the json string. what am i missing here? and how can i use that, cause according to it i want to write the query to the database.
post data stringgetting null with the decode
best regards
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros