Angular pass value to PHP use HTTP POST
Hi all I use angular + PHP ex : http://12345/6789/1999 I want to get the 1999 value and pass to the PHP Code
Routing { path: 'nna/:id', component: NnaComponent}
TS this.id = this.route.snapshot.paramMap.get('id'); this.id=JSON.stringify(this.id); this.http.post('http://localhost:8888/php/test.php', this.id, { responseType: 'text'}).subscribe(id=> { console.log(this.id);
PHP header('Access-Control-Allow-Origin: *'); header('Content-type: application/json'); header("Access-Control-Allow-Origin: *"); header('Access-Control-Allow-Headers: X-Requested-With, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers');
$postdata =file_get_contents("php://input"); $request = json_decode($postdata ); echo $request;
PHP can't get the 1999 value.... Thank you
Please or to participate in this conversation.