sending post data from the Yun to a webpage

Please help, I cannot find any samples in the web.

I want to send some text from my Yun to a webpage. My first try was to use Bridge HttpClient with GET URL-Parameters like this: client.get("http://mypage.php?data=blablabla&data2=something")

But I have large texts and also with many not in URLs acceptet characters. So for me would be much better to send data via the POST-method like in Web-Forms. But how does that work with the Yun??? I tryed samples for the Ethernet and the Wifi Libraries, but this does not work with the Yun. There are thousends of samples to send data with Yun to existing webservices but nothing to send data simpli to the own PHP-Webpage.

Please help, I don't know how to finish my project.


Why not send the data to the sd card and call a script that does a the http calls?

Hello Jantje,

thanks for the fast respoding. Do you mean, I should call a phyton-script on the linux-part for that? If that is a solution, I could do that. But I don't know phyton. Are there some examples for that?

I wonder, why the bridge-library does not support a solution for sending post data to a webpage. Is that only for me important?

I'm not saying that what I propose is the "only option". It is just an option I know will work. It doesn't have to be python. It can be any "language" that yun can handle. Such as python, lua, ash ...... I personally would look at the curl command. I'm using it to get data (from my yun1 to my yun2 and the other way around) but it also supports post.

Heiko73: I wonder, why the bridge-library does not support a solution for sending post data to a webpage. Is that only for me important?

There are so many ways to do this (and so many other things) that you can not expect Arduino to support all of them with a method. If you are working with the yun some basic openwrt/linino/linux knowledge is very handy. This because you can move "actions" to linino very easily if you know your options on linino.

Best regards Jantje

Ok, I would be more than happy, if someone can post a short sample how to send data (a text) to a Webserver with a known URL. Here my really simple sample wich only works with short text :

HttpClient client; client.get("http://mypage.php?mytext=this%20is%20my%20text");

May be, in future HttpClient will have a "post" method or some methodes to manage the request-body.

Again: Given samples with WiFi do not work with the Yun. They all need the Wifi-Shield. No chance to do that with Yun?

some days ago i has the same problem…:smiley:
there’s the solution

#include <Bridge.h>
#include <Console.h>
#include <FileIO.h>
#include <HttpClient.h>
#include <Mailbox.h>
#include <Process.h>
#include <YunClient.h>
#include <YunServer.h>

#include <SPI.h>
//#include <Ethernet.h>

//byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(10,33,66,149); // 
//EthernetClient client;
YunClient client;

int temp = 64;

void setup()
  String parametri ="";


  if (client.connect(server, 80)) 
    client.println("POST /prova/inserisci.php HTTP/1.1");
    client.println("Connection: Close");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.println(parametri);     //Set Remote temperture to ___
    Serial.println("connection failed");
void loop()
  if (client.available()) {
    char c =;
  if (!client.connected()) {

the comment here because the original sketch was for arduino Uno
the sketck send only one variable but you can expand easily for any number of variable


Piero, you are the hero of the day, it works perfect :smiley:

You only have to include <Bridge.h> and <YunClient.h>, not the other libraries. To your honour I will keep the name of the String “Parametri” in my project :wink:


@Piero76 Karma+

Hi Piero, Might you show me the code of the php file "insercici.php"

Piero, will this work with xampp as a server? I can't see any data in my server or as what luisea said can you show the php file