Using the Arduino Ethernet Shield and PHP Web


hello,

could me syntax needed sending parameter via ethernet shield client.print statement?

i reading analog value of pin....when send serial reads value fine.

when construct code pass parameters php website, code works fine hard coded values ie:

client.println("get /test.php?value0=123&value1=456");

this sends code website..my php script grabs , website output of 123 , 456.

when try little more coding, capture analog reading int variable....but when try pass bad response apache ie;

client.print("get /test.php?value0=");
client.print(analogvalue);
client.print(&value1=456);
client.println(" http/1.1\n");

as see i'm trying code line consisting of text , analog value....but doesn't work.

i've looked @ kinds of examples on web can't seem work out how pass variable within text string?

please help.

thanks

try this:

code: [select]
client.print("get /test.php?value0=");
client.print(analogvalue);
client.print("&value1=");
client.print(456);
client.println(" http/1.1");
client.println();


don't forget use # button in forum post code.  (select code, press # button...)

the reason bad request because haven't sent headers.

get [page&querystring] [protocol]\r\n
first line, followed headers, followed by
\r\n [edit]on blank line[/edit] signal end of headers.

(my code above has second println skip http headers.)

check out rfc on http protocol more info: http://www.faqs.org/rfcs/rfc1945.html


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Using the Arduino Ethernet Shield and PHP Web


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums