Curl command with integer data

So I have some sensors which I would like to connect to a php script I and stores the GET data as variables.

I can curl to the script by hardcoding the values iecurl

but when I try using curl"+dataVariable+"

it produces an error complaing that the int data has to be converted to a string...

so I do the same thing but I wrap the variable in String(dataVariable) and it works although the variable now uploads as 0 each time.

I'm storing the data as an int on both my database and on the arduino sketch .. it is holding data from 100 - 15000 so I assume an int is ok to hold it (it works fine when I send it to the Console to view but just wont upload well)

I don't see that your problem has anything to do with the Arduino.

I don't see that it has anything to do with curl, either.

Of course, the good folks at might be able to help you with your snippets. They make no sense to me.

Well I want to use Curl and I also want to use my Arduino so I figured posting on the Arduino forum would be sensible.

I'm asking how can I curl a variable into a link to a script.

I'm asking how can I curl a variable into a link to a script.

And, I'm asking what the hell this even means. A variable is a memory location that holds a value. Is the memory location in question on the Arduino? If so, then you can't use the contents of that memory location in a call to a function that runs on the PC.

If not, just where does that memory location live?

I have already said I have a php script that takes GET data ... so if I go to the link

the script will take the value of 10 and store it in a database. I don't want to have a hardcoded value of 10 but instead a variable of x that I can change.

So instead of doing curl id like to do curl

Where X can be anything.

Now I have seen this done with the example of uploading data to a google spreadsheet so I know it can be done, the issue here is when I use my variable which is an int .. it gives an error that it should be a string. When I convert to string the value = 0

and if you're getting confused, the arduino yun can use curl ... I'm not trying to use it on a pc.

You could use sprintf


Make a char array called buffer
char buffer[50];

your value is 17

int val=17
sprintf (buffer, “”, val);

now you can use Curl

Curl buffer

Below is a test sketch I made, just to test my database

  Running process using Process class. 
 This sketch demonstrate how to run linux processes
 using an Arduino Yún. 
 created 5 Jun 2013
 by Cristian Maglie
 This example code is in the public domain.


#include <Process.h>
char buffer[50];
int val=1200;

void setup() {
  // Initialize Bridge
  // Initialize Serial
  // Wait until a Serial Monitor is connected.
  while (!Serial);

  // run various example processes

void loop() {
  sprintf (buffer, "arduino.local/sd/test/upd_testdb.php?tekst=%d", val);  
  // Do nothing here.

void runCurl() {

  // curl is command line program for transferring data using different internet protocols
  Process p;		// Create a process and call it "p"
  p.begin("curl");	// Process that launch the "curl" command
  p.addParameter(buffer); // Add the URL parameter to "curl";		// Run the process and wait for its termination

  // A process output can be read with the stream methods
  while (p.available()>0) {
    char c =;
  // Ensure the last bit of data is sent.

and if you're getting confused, the arduino yun can use curl ... I'm not trying to use it on a pc.

Then, why the f**k aren't you posting in the Yun section of the forum? And, where the hell is your code, so your question even makes sense?