I want to send post params to a endpoint, this m const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
})
};
return this.http.post('http://localhost/post.php', {
"name": "Customer004",
"email": "customer004@email.com",
"tel": "0000252525"
}, httpOptions);
}
In localhost/post.php i got the follow code:
<?php
print_r($_POST);
The problem is that the navigator is sending the data in incorrect format. The browser send the follow: in incorrect format instead: in correct format
The response of the php code is:
Array ( [{"name":"Customer004","email":"customer004@email_com","tel":"0000252525"}] => )
instead:
Array ( ["name"]=>"Customer004",["email"]=>"customer004@email_com",["tel"]=>"0000252525" )
Where is the problem?