I try to execute a simple PHP file and get this return or echo, it is possible with Angular 8 ?
I well build my Angular project with ng build and put it in Nginx server with PHP configuration
My PHP file don't have a spell mistake error, and I put it inside the make-bulletin inside asset folder.
Actually I made a service sending a POST request in my PHP file locally
I also try with, return this.http.post("assets/make-bulletin/test.php"... but it happen the same thing
My service:
public makeBulletin(ville: string, pollution: string, date: string) {
return this.http.request("POST", "assets/make-bulletin/test.php", {
params: {
Ville: ville,
Pollution: pollution,
Date: date,
},
})
}
My .ts for call my service and subscribe:
public onSubmit() {
this.bs.makeBulletin("Lyon", "Atmospherique", "2019-06-01").subscribe(
resp => {
// How print PDF to the user after get the PDF ?
},
error => {
// get error
}
)
My PHP file:
<?php
$ville = $_POST["Ville"];
echo $ville;
return $ville;
?>
I tried to add:
header("Content-type: text/html") and header("Access-Control-Allow-Origin: *")
But I get a 200 OK so good... but, with a null response in my resp...
How can I get/read a answer from my PHP file ?
Thanks in advance
localhost:/some-url