+ 1
Which language will you recommend for interacting with php and/or sending HTTPRequests?
I'm trying to make a project which is going to connect a server, ping a php file and will return an output - not the whole php file. I have a test file to try which is uploaded to server but it's always returning html file. So please help me, I'm outta ideas.
3 ответов
+ 1
@Draphar
The client will send a HTTP request to a php server file.
Php file will generate an output.
The server will return output.
The client acts according to the output.
0
What do you mean by saying "connect to a server"?
0
Javascript fits well:
const xhr = new XMLHttpRequest;
xhr.open("GET", "<yourphpurl>.php"); // change the method if you need to
xhr.onloadend = function(){
if(xhr.response === "OK"){
// do something
}else if(response === "Error"){
// do something else
}else{
// huh unexpected output
}
}
xhr.send();