c++ - how to send float value in url , im sending float value but getting Null values -


i want send values , insert values database, im getting null values.

 float phvalue = value/10;   float dovalue= 12.22;   gprsserial.println("at+httppara=\"url\",\"http://itempurl.com/smartpond/addtemprature?watertemperature=""+celsius+""&phvalue=""+phvalue+""&dovalue=""+dovalue+""&currenttime=06-30-2016\""); 

you can send separately using print() like:

int n_decimals = 3; float phvalue = value/10; float dovalue= 12.22;  gprsserial.print("at+httppara=\"url\",\"http://itempurl.com/smartpond/addtemprature?watertemperature="); gprsserial.print(celsius, n_decimals); gprsserial.print("&phvalue="); gprsserial.print(phvalue, n_decimals); gprsserial.print("&dovalue="); gprsserial.print(dovalue, n_decimals); gprsserial.println("&currenttime=06-30-2016\""); 

with n_decimals number of decimal places want printed.

or @stark says in comments can use snprintf generate @ command:

char command[256]; float phvalue = value/10; float dovalue= 12.22;  snprintf(command, sizeof(command), "at+httppara=\"url\",\""           "http://itempurl.com/smartpond/addtemprature?"           "watertemperature=%f&phvalue=%f&dovalue=%f"           "&currenttime=06-30-2016\"", celsius, phvalue, dovalue); gprsserial.println(command); 

note: wasn't sure if want values in url go between quotes, left them without.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -