I have an Angular6 app and I want to send a JSON to the REST api in PHP, then get all the fields to make a insert query.
This is my function in angular:
createUser(user: User) {
const jsonParms = JSON.stringify(user);
this.http.post('http://localhost:80/angular/newUser.php', jsonParms).pipe(map(data => {
console.log(data.json());
return data.json();
})).subscribe();
}
How do I have to recive the JSON in php and extract the fields to make an insert in mysql?