I am trying to post data to a MySQL server.
All the examples I can find online are going over my head a bit because they all use PHP and I don't have a great understanding of how Arduino runs PHP scripts.
In this Instructables Example they create a connect.php and add.php file. The add.php file refers to the connect.php.
In the arduino sketch, the add.php is called in this line:
client.println("POST /add.php HTTP/1.1");
How exactly does the add.php run? Does arduino run the code or does it simply pass on the file to the server?
How does arduino know that "add.php" is a file instead of just some text it needs to print?
Do I need to #include the .php files at all? The example does not use any include keywords for the .php files, however, I have seen it used in other examples where .php files are used.
If I write that same line of code in a separate .cpp file and have arduino call the function, would it have the same effect (I will use my own print function of course)? This is important because the 3G module I'm using has all the communication functions in a .cpp file so I'm editing the .cpp file.
The "POST /add.php HTTP/1.1" text is parsed by the web server which attempts to find the "add.php" file within the file system on the machine hosting the web server, and then launches the PHP interpreter as a sub-process or thread within the web server.
Thanks everyone for replying, I'm starting to understand it a little better now.
mikb55:
The "POST /add.php HTTP/1.1" text is parsed by the web server which attempts to find the "add.php" file within the file system on the machine hosting the web server, and then launches the PHP interpreter as a sub-process or thread within the web server.