How to send GET requests to a form PHP

I just got my Yun yesterday and I am trying to send a GET request to a PHP file that takes in 2 GET parameters. I know my code is wrong because I am not familiar with the Yun's library use so I was hoping someone can help me with how to properly write the sensor data and make the GET request using the Yun client.

#include <Bridge.h>
#include <HttpClient.h>

int sensor1Pin = A0;
int sensor2Pin = A1;
float input1;
float input2;
void setup() {
// Bridge takes about two seconds to start up
// it can be helpful to use the on-board LED
// as an indicator for when it has initialized
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);

Serial.begin(9600);

}

void loop() {
// Initialize the client library
HttpClient client("http://myHost.ca/oaab/");

input1=analogRead(sensor1Pin);
input2=analogRead(sensor2Pin);

client.print( "GET /add.php?");
client.print("temp1=");
client.print( input1 );
client.print("&&");
client.print("moi1=");
client.print( input2 );
client.println( " HTTP/1.1");
client.println( "Host: http://myHost.ca/oaab/" );
client.println( "Content-Type: application/x-www-form-urlencoded" );
client.println( "Connection: close" );
client.println();
client.println();
client.stop();

delay(5000);
}

This is the error I get with current code:

sketch_jul12a.ino: In function 'void loop()':
sketch_jul12a.ino:26:67: error: no matching function for call to 'HttpClient::HttpClient(const char [45])'
sketch_jul12a.ino:26:67: note: candidates are:
In file included from sketch_jul12a.ino:4:0:
C:\Program Files (x86)\Arduino\libraries\Bridge\src/HttpClient.h:26:5: note: HttpClient::HttpClient()
HttpClient();
^
C:\Program Files (x86)\Arduino\libraries\Bridge\src/HttpClient.h:26:5: note: candidate expects 0 arguments, 1 provided
C:\Program Files (x86)\Arduino\libraries\Bridge\src/HttpClient.h:24:7: note: HttpClient::HttpClient(const HttpClient&)
class HttpClient : public Process {
^
C:\Program Files (x86)\Arduino\libraries\Bridge\src/HttpClient.h:24:7: note: no known conversion for argument 1 from 'const char [45]' to 'const HttpClient&'
sketch_jul12a.ino:46:12: error: 'class HttpClient' has no member named 'stop'

You can use process CUrl.

Much easy.

 Send.begin("curl");  // Process that launch the "curl" command
    String Sitourl = sito + "/inserisci.php?tempo=" + nowdb + "&temperatura=" + settemp + "&umidita=" + setumid + "&stato=" + stato + "&setpoint=" + settemperatura / 100 ;
    Send.addParameter( Sitourl ); // Add the URL parameter to "curl"
#ifdef debug
    Serial.println (Sitourl);
#endif
    Send.runAsynchronously();// Run the process and wait for its termination
    while (Send.running());

    String risp;
#ifdef debug
    Serial.println ("send run");
    Serial.println(Send.exitValue());
#endif

    if (Send.exitValue() == 0 && Send.available() > 0) {

      risp = Send.readString();
      Send.close();
    }



    else
    {
#ifdef debug
      Serial.println("send timeout");
#endif
      b++;
      Send.close();

    }

    risp.trim();
#ifdef debug
    Serial.println (risp);
#endif

I have NO clue what is going on....I know arduino Yun has a Linux side but I don't know how to program in Linux.....I have only used arduino before...I have a project for class due soon and Arduino keeps letting me down. From your code I modified to get the below but I get some errors:

#include <Process.h>

void setup() {
  // Initialize Bridge
  Bridge.begin();

  // Initialize Serial
  Serial.begin(9600);

  // Wait until a Serial Monitor is connected.
  while (!Serial);

  // run various example processes
  runCurl();
  runCpuInfo();
}

void loop() {
  // Do nothing here.
}

void runCurl() {
int sensor1Pin = A0;
int sensor2Pin = A1;
float input1;
float input2;
  input1=analogRead(sensor1Pin);
  input2=analogRead(sensor2Pin);
  


Send.begin("curl");  // Process that launch the "curl" command
    String Sitourl = "http://oob.ca/~data/add.php?temp1=" + input1 + "&moi1=" + input2;
    Send.addParameter( Sitourl ); // Add the URL parameter to "curl"
#ifdef debug
    Serial.println (Sitourl);
#endif
    Send.runAsynchronously();// Run the process and wait for its termination
    while (Send.running());

    String risp;
#ifdef debug
    Serial.println ("send run");
    Serial.println(Send.exitValue());
#endif

    if (Send.exitValue() == 0 && Send.available() > 0) {

      risp = Send.readString();
      Send.close();
    }



    else
    {
#ifdef debug
      Serial.println("send timeout");
#endif
      b++;
      Send.close();

    }

    risp.trim();
#ifdef debug
    Serial.println (risp);
#endif

}

Error:

Arduino: 1.5.7 (Windows 7), Board: "Arduino Yún"

Build options changed, rebuilding all

sketch_jul12a.ino: In function 'void setup()':
sketch_jul12a.ino:15:14: error: 'runCpuInfo' was not declared in this scope
sketch_jul12a.ino: In function 'void runCurl()':
sketch_jul12a.ino:32:1: error: 'Send' was not declared in this scope
sketch_jul12a.ino:33:61: error: invalid operands of types 'const char [35]' and 'float' to binary 'operator+'
sketch_jul12a.ino:60:7: error: 'b' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Ok,

You need study a bit more the code. Don't copy and paste but try understand how the code works :P.

if you have any question there are a lot of people here could help You

Below are your functional code modify by me:

#include <Process.h>

#define debug   // comment this line to disable Serial comunication


Process Send;  // declare the process Send

void setup() {
  // Initialize Bridge
  Bridge.begin();

  #ifdef debug
  
  // Initialize Serial
  Serial.begin(9600);

  // Wait until a Serial Monitor is connected.
  while (!Serial);
  

  
#endif

delay (5000); // wait uboot finish ( linux side must be boot-up)  

 
}

void loop() {
  
// run various example processes

  runCurl();
  delay(2000);
  runCpuInfo();
  delay(2000);
  runprocess_datetime();
  delay(2000);

}

void runCurl() {
int sensor1Pin = A0;
int sensor2Pin = A1;



/*
float input1;
float input2;
  input1=analogRead(sensor1Pin);
  input2=analogRead(sensor2Pin);*/


// Must be a String not a float ( 0 to 1023  analog input value)
 String input1= String(analogRead(sensor1Pin),DEC);
 String input2=String (analogRead(sensor2Pin),DEC);
// ***********************************************************
  


Send.begin("curl");  // Process that launch the "curl" command
    String Sitourl = "http://oob.ca/~data/add.php?temp1=" + input1 + "&moi1=" + input2;
    Send.addParameter( Sitourl ); // Add the URL parameter to "curl"
#ifdef debug
    Serial.println (Sitourl);
#endif
    Send.runAsynchronously();// Run the process and wait for its termination
    while (Send.running());

    String risp;
#ifdef debug
    Serial.println ("send run");
    Serial.println(Send.exitValue());
#endif

    if (Send.exitValue() == 0 && Send.available() > 0) {

      risp = Send.readString();
      Send.close();
    }



    else
    {
#ifdef debug
      Serial.println("send timeout");
#endif
     
      Send.close();
	   /* b++;*/  // b is not declare

    }

    risp.trim();
#ifdef debug
    Serial.println (risp);
#endif

}

void runCpuInfo() {
  // Launch "cat /proc/cpuinfo" command (shows info on Atheros CPU)
  // cat is a command line utility that shows the content of a file
  Process p;		// Create a process and call it "p"
  p.begin("cat");	// Process that launch the "cat" command
  p.addParameter("/proc/cpuinfo"); // Add the cpuifo file path as parameter to cut
  p.run();		// Run the process and wait for its termination

  // Print command output on the Serial.
  // A process output can be read with the stream methods
  while (p.available() > 0) {
    char c = p.read();
	#ifdef debug
    Serial.print(c);
	#endif
  }

  #ifdef debug
  // Ensure the last bit of data is sent.
  Serial.flush();
  #endif
}



void runprocess_datetime()
{
	
  Process date;
  date.begin("date"); // call process time
  date.addParameter("+%D-%T"); // %D = date %T time 
  date.run();
  while (date.running());

  String timeString = "";
  if (date.available() > 0) {
    timeString   = date.readString();

  }

 
#ifdef debug
  Serial.println(timeString);

#endif


  
 
}

Regards,

Davide Marchetto