Go Down

Topic: Arduino ethernet webclient php script and mysql (Read 61 times) previous topic - next topic

xsilvergs

#30
Dec 21, 2010, 12:49 pm Last Edit: Dec 21, 2010, 04:46 pm by xsilvergs Reason: 1
zoomkat

Well that was very handy, pasting http://192.168.1.20/update_db.php?celsius=45 updated the database. I then changed the get statement to client.println("GET /update_db.php?celsius=45 HTTP/1.0"); and that updated the database also. Thank you.  :)

At this moment I don't understand:
Code: [Select]

int d1 = readString.indexOf('<');
int d2 = readString.indexOf('>');
readString1 = (readString.substring(d1+1,d2));

and what it's trying to do or how it works. I understand .indexOf but not sure how the String works

Tony

zoomkat

The readString.indexOf('<'); finds the location of "<" in the info sent by the server. The actual useable data set from the server has < and > delimiters on each end. Based on the info sent from the arduino client to the server, the application run by the server may determine the arduino client needs to take some action. If the arduino client is monitoring temperature and decides it needs to send "celsius=45" to the server, the server could send back <heater1=off> and then the client could turn heater1 off. Just simple communication between the client and server.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

xsilvergs

What sort of file do I need on the server to send such to the Arduino? Sorry if this seems a silly question but the is all new to me.

An example would be great.

zoomkat

Quote
What sort of file do I need on the server to send such to the Arduino? Sorry if this seems a silly question but the is all new to me.


If the requested file is in the web page directory of the server, the server will send it. If the request sent to the server requires evaluation to develop a response, then an application on the server takes the info sent to the server, processes it, then sends the info to the server for return to the client. I'm clueless to the php/mysql stuff, so you are on your own there. With my simple setups using windows/apache, I use a batch file or an exe as a cgi application to do stuff on the server pc, such as pan/tilt my web cam.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

xsilvergs

So would I use the Post method from a html Form or is there a different method?

Thanks for any info

Go Up