MarcoMartines / GSM-GPRS-GPS-Shield

GSM/GPRS & GPS Shield Library for modules using SIM900/SIM908
GNU General Public License v2.0
208 stars 152 forks source link

how to use a String in the function inet.httpGET #25

Closed simsasaile closed 9 years ago

simsasaile commented 9 years ago

Hi,

thank you for that nice library! I succeeded to establish a connection to my server with inet.httpGET("my.server.com",80,"/some/path",response,200);

But the path "/some/path" should contain a variable, so i did build a string with the variable before and wrote only the name of the string there instead of "/some/path"

String myString = "/test/123/";
inet.httpGET("my.server.com",80,myString,response,200);

But that's not working, I get the following error message: no matching function for call to 'InetGSM::httpGET(const char [16], int, String&, char [200], int)'

I'd be very glad for any hint how to achieve that!

simsasaile commented 9 years ago

Ok I think I found the solution: convert the String to char:

char charBuf[132];
myString.toCharArray(charBuf, 132);

inet.httpGET("my.server.com",80,charBuf,response,200)