Im going to be sending information to a server and ive found this code from a similar project that does the same thing. I was wondering if anyone could help me understand the parts that have '//' next to them.
The first statement is sending a GET request to the server. The second statement is appending a value to the GET request. The third statement is sending the rest of the GET request. The next statement assumes that the server is hosting multiple domains, and, therefore, needs to be told which domain the script belongs to (a usually incorrect assumption, but one that doesn't cause any harm).
The next set are sending data that is most likely not needed. It is possible for the server to tailor the output if it knows what the requesting device is capable of, but that is not necessary information to send, and most scripts/servers ignore the values.
The GET part is the command type. The /php_get_write.php part is the name and path of the script to execute on the server. The ? indicates the start of name=value pairs. The name in the example is state. The value is added later (42).
Im guessing this code wont work for me?
If you connect to the correct server, where you have a script called php_get_write.php, in the root directory of the server's web directory, then it should work.