HTTP Request with Arduino Yun

Hi Forum,

I have an Arduino Yun and he is connected to my wireless Network. I would like to send an HTTP Request to a PC that is connected on the same network.

Can somebody help me with an easy example how to do it?

Thank you very much

In the IDE, select File from the menu, then Examples, then Brdige, then HTTPClient

Voila!

Hi, I want to make a POST Request and not a get.

Can you help?

Well what I exactly need is:

I need just to simple call to http://192.168.1.1/index.html as I would call with a browser. And thats it.

My Server (http://192.168.1.1/index.html ) will detect automatically that was called from another system.

Can somebody help?

etrust: Hi, I want to make a POST Request and not a get.

See http://forum.arduino.cc/index.php?topic=221809.msg1611421#msg1611421 for help on how to do POST.

Hi, I still have a problem,

What I want to do:

When I put this url in my web browser on the laptop, so my home lamp turns on: http://192.168.1.114:8083/API/Run/devices[2].instances[0].SwitchBinary.Set(1)

I dont want to use my browser. I want this same effect using my arduino yun. I tryed httpclient, curl but it didnt help.

Can somebody help me?

Check out Chagrin's link there, that sure helped me out XD

Hi, I have tested but it does not work:

#include <Process.h>

void setup() {
  Bridge.begin();	// Initialize the Bridge
  Serial.begin(9600);	// Initialize the Serial

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

void loop() {
  Process p;
  // This command line runs the WifiStatus script, (/usr/bin/pretty-wifi-info.lua), then
  // sends the result to the grep command to look for a line containing the word
  // "Signal:"  the result is passed to this sketch:
  p.runShellCommand("http://192.168.1.114:8083/API/Run/devices[2].instances[0].SwitchBinary.Set(1)");

  // do nothing until the process finishes, so you get the whole output:
  while (p.running());

  // Read command output. runShellCommand() should have passed "Signal: xx&":
  while (p.available()) {
    int result = p.parseInt();			// look for an integer
    int signal = map(result, 0, 100, 0, 255);	// map result from 0-100 range to 0-255
    analogWrite(9, signal);			// set the brightness of LED on pin 9
    Serial.println(result);			// print the number as well
  }
  delay(5000);  // wait 5 seconds before you do it again
}

Can somebody help?

I would suspect that the Linux shell is angry at your brackets. Try:

p.runShellCommand("http://192.168.1.114:8083/API/Run/devices\[2\].instances\[0\].SwitchBinary.Set(1)");

Hi!

This was a great idea but now I have this error:

sketch_mar01b:16: error: unknown escape sequence ']'

Have you an idea?

Take a look here: http://fpwing-eng.blogspot.it/2014/02/confessions-of-fpv-pilot-rover-part-3.html

bye