So I have this code:
axios({
method: 'post',
url,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: {
json,
type,
}
})
Originally I had the normal axios.post
but I changed to this because I thought it might have been a header problem. However I am still detecting nothing in my $_REQUEST
nor $_POST
. However, it is receiving data in file_get_contents("php://input")
.
Any idea what is wrong?
Edit
Okay I think I know what's wrong. It's posting it as a json object so it can only be read in the php://input. How do I change it to a normal string in axios?
From the documentation (I haven't preserved links in the quoted material):
or
api
You can use jQuery.param
You can now use postdata has your post parameter