Go Down

Topic: Arduino gsm shield (Read 494 times) previous topic - next topic

dhiru

hello
I am using arduino GSM shield to send data wirelessly to database using php
My requirement is store data in database , data need to be in URl bar in this format-"localhost/?x=5&y=4&z=3"
x,y,z are variable and 5,4,3 are values from analogRead.
How to post or print data in URL bar ?
How to automatically refresh it ?

PaulS

Quote
How to post or print data in URL bar ?

Just like you'd do it in any other kind of bar. The precise mechanism depends on how the data is being used. Typically, the entire URL does not have to be sent in one print() call. So, just send it in bits and pieces.

Quote
How to automatically refresh it ?

Well, now, don't you suppose that that would depend a lot on what "it" is?

dhiru

Thanks for reply
It will be with help of client.println( )  ?
please give example....

PaulS

Quote
It will be with help of client.println( )  ?

Then, use multiple client.print() statements and one client.println() statement.

/?x=5&y=4&z=3 would be sent like so:

Code: [Select]
int x=5;
int y=4;
int z=3;

client.print("/?x=");
client.print(x);
client.print("&y=");
client.print(y);
client.print("&z=");
client.print(z);
client.println("The rest of the GET command");

dhiru

thanks
will client.println( ) print the content in URL Bar directly ?

because to store in database my requirement is that it should print variable along with its value in above mentioned format in address bar.

PaulS

Quote
will client.println( ) print the content in URL Bar directly ?

I don't know what this question means. A "URL bar" is a feature of a web browser, as far as I know. The client.print() function does not communicate with a web browser, so the answer would be no, as I understand what a "URL bar" is.

The client.print() function communicates with a server, and is how a GET request is made.

A browser application takes the information in the "URL Bar", parses it, and makes GET requests, too.

Quote
because to store in database my requirement is that it should print variable along with its value in above mentioned format in address bar.

In the above mentioned format, yes. In the address bar, no!

Go Up