Go Down

Topic: Arduino Ethernet send to php (Read 3290 times) previous topic - next topic


I suggest you stop mucking about with string formatting that you evidently don't understand yet, and just type the URL into your sketch:

Code: [Select]
char *pageAdd = "/controlpanel/getalarm.php?alarmstate=0";

Or whatever values you want to use for testing. You can confirm that the path is correct by typing the corresponding URL into the address field of your browser.

Does the browser show the response you expected? The Arduino should receive the same response, if the network access is succeeding.

Yes in this way i get the right response....How can i i change 0 with the value?


Yes in this way i get the right response....How can i i change 0 with the value?

That's great news. Now we know the only problem is the format of the request string.

Your code to generate it using sprintf was along the right lines. You would need something like this:

Code: [Select]

char pageAdd[64];
int alarmstate=0;
sprintf(pageAdd, "/controlpanel/getalarm.php?alarmstate=%d", alarmstate);

That should produce the same behaviour as before. If it doesn't, print the value of pageAdd before you make the page request, and compare it carefully with the fixed string that you know works correctly.
I only provide help via the forum - please do not contact me for private consultancy.


This works correctly but what %d define? I ask because i want to understand how it works so i can send to the web and other values...


Here is a list of things sprintf does and how to use them. The float stuff doesn't work last time I checked.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131