Level 53
Why are you executing that script? Isn't it easier if you just run the code when the request gets to that route?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there a way to execute php script with axios? This is what I am trying and it gives me back all the code back in response instead of executing.
axios.get('http://localhost:8080/script.php', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Allow-Control-Allow-Origin': '*'
},
params: {
'id': 1
}
})
.then((response) => (
console.log(response)
))
.catch((error) => (
console.log(error)
))
Please or to participate in this conversation.