Arduino cURL post

hi,
I have an Arduino running as a Web server with a simple web page that looks like this:

EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 100) {
readString += c;
}
if (c == ‘\n’) {
if(readString.indexOf(’?’) >=0) { //don’t send new page
client.println(F(“HTTP/1.1 204 House”));
client.println();
client.println();
}
else {
client.println(F(“HTTP/1.1 200 OK”)); //send new page on browser request
client.println(F(“Content-Type: text/html”));
client.println();
client.println(F(""));
client.println(F(""));
client.println(F(“House CTRL”));
client.println(F(""));
client.println(F(""));
client.println(F(“

System

”));
client.println(F(“Timestamp:”));
client.println(timestamp);
client.println(F("
Temperature:"));
client.println(temperature);
client.println(F("
Lights:"));
client.println(lights);
client.println(F(""));
client.println(F(""));
client.println(F(""));
}
delay(1);
client.stop();
if(readString.indexOf(‘2’) >0)
{
Serial.println(“UPDATE”);
delay(1000);
}
if(readString.indexOf(‘3’) >0)
{
Serial.println(“Lights ON”);
lights=1;
delay(1000);
}
if(readString.indexOf(‘4’) >0)
{
Serial.println(“Lights OFF”);
lights=0;
delay(1000);
}

readString="";
}
}
}
}

so, if from a web browser i acess http:\ arduino ip?on=3 it will turn on the lights.

my problem is that i want to have an php page with a cURL post to send the ?on=3 directly to the arduino.

i have this code on the web page:

<form action="" method="post">
	<input type="submit" name="send_update" value="Lights on" />
</form>

<?php

if(isset($_POST['send_update']))
{
	// create a new cURL resource
	$ch = curl_init();

	// set URL and other appropriate options
	curl_setopt($ch, CURLOPT_URL, "http://ip arduino/?on=2");
	curl_setopt($ch, CURLOPT_HEADER, 0);

	// grab URL and pass it to the browser
	curl_exec($ch);

	// close cURL resource, and free up system resources
	curl_close($ch);
}

?>

but it’s not working. Do i need to change something in the arduino web page to accept cUrl post?

Do i need to change something in the arduino web page to accept cUrl post?

The Arduino won’t know, or care, that curl created the GET request. So, no.

What you do need to do is see what curl is ACTUALLY assembling as the GET request.

      if (client.available()) {
        char c = client.read();
        if (readString.length() < 100) {
          readString += c;
        }

Print the contents of c before you piss away resources putting the letter in the String. The request may not be matching your expectations.