Hello, I have been trying for more than a week now, to figure out how to send and get data as secure as possible to a remote server using a WiFi Shield.
I am able to connect to the server and receive the HTTP response, but so far I have not been able to read a variable from a webserver and change the HTML page with information from the Arduino to reflect any changes (LED On/Off). I have seen many examples here on the forum and on the web, but all of the ones I have seen use the Arduino as a webserver, in my case is just a web client. I am attaching the web page code and the arduino code (obviating everything before the connection to the server, since this works fine).
I have been looking at HTML coding and PHP but cannot figure out how to use it with Arduino, besides having a thick skull

, so any help will be greatly appreciated.
BTW: The idea is to use HTML and PHP, without javascript, etc. So it is more secure and the website can be accessed by the simplest of smartphones.
WEBSITE CODE:
-----------------------------------------------------------------------------------------------------------------------
<?php
$counter = isset($_POST['counter']) ? $_POST['counter'] : 0;
if($_POST['submit'] == true) {
$counter++;
}
switch ($counter) {
case 0:
break;
case 1:
break;
default:
$counter=0; }
?>
<!DOCTYPE html>
<html>
<head>
<title>Light On/Off Switch</title>
</head>
<body>
<H1>Light Switch Example</H1>
<form name="LED" method="POST" action="#">
<input type="hidden" name="counter" value="<?php print $counter; ?>" />
<input type="submit" name="submit" style="height: 100px; width: 100px" value="LED Switch">
</form>
<br />
<?php echo "Counter: " . $counter; ?>
</body>
</html>
-------------------------------------- END OF WEBSITE CODE -----------------------------------------------------
ARDUINO CODE:
-----------------------------------------------------------------------------------------------------------------------
boolean currentLineIsBlank = true;
boolean DoPage=true; //
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
client.println("<?php echo $_GET['counter']; ?>");
Serial.println();
Serial.println("The value for counter is: ");
Serial.println(counter);
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting from server.");
client.stop();
// do nothing forevermore:
while(true);
}
}
}
}
--------------------------------------------- END OF ARDUINO CODE ---------------------------------------------