Which language will you recommend for interacting with php and/or sending HTTPRequests? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

26th Jan 2018, 1:52 PM
Arda Aydın
Arda Aydın - avatar
3 Answers
+ 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.
26th Jan 2018, 1:59 PM
Arda Aydın
Arda Aydın - avatar
0
What do you mean by saying "connect to a server"?
26th Jan 2018, 1:57 PM
Draphar
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();
26th Jan 2018, 2:12 PM
Draphar