Agree with @avp
Read the book before you climb to where it is not clear. In any textbook, a similar problem is considered.
Many have already written that either pass this question past, or at least give a link to the topic where you can read.
And on the issue. Well, firstly, where is php lying around? on the server with an apache? if so, you can access the page at its address http: //localhost/somepage.php and get an answer to the screen Text ot servera
Text ot servera. How to transfer data in json or xml?
Transfer data in which direction? To the server or from the server?
If to the server, then either GET or POST. Get the data, again, depending on what and how to give it to you. Just show, or show in a certain format, or give them away.
Actually, I advise you to correct the question for the better, more constructive!