Arduino + EtherCard enc28j60 + 2 thermistors + POST how to?

Hello to all.
After making the code for an arduino + enc28j60 + 2 thermistors and web server to work, now i want to send a POST to a server so i can log the informations to a mysql server and then read them from outside the house network.
The link to wich i want to send the POST is
Can someone help me to include into my existing code the part of code witch will do what i want?
My actual code is:

#include <UIPEthernet.h> // Used for Ethernet
int ThermistorPin = 0;
int ThermistorPin1 = 1;
int Vo;
int Va;
float R1 = 4600;
float R4 = 9900;
float logR2, logR3, R2, R3, T, T1, Tc, Tr;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

// Ethernet MAC address - must be unique on your network
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 };                                      
// ethernet interface IP address (unique in your network)
IPAddress ip(192, 168, 0, 200);                        
// ethernet interface IP port (80 = http)
EthernetServer server(80);

EthernetClient client;

void setup() {
  // Open serial communications:

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);

  Serial.println(" - Temperature Drone - v1.0");
  Serial.print("IP Address: ");

void loop() {

Vo = analogRead(ThermistorPin);
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  Tc = T - 273.15;
  Va = analogRead(ThermistorPin1);
  R3 = R4 * (1023.0 / (float)Va - 1.0);
  logR3 = log(R3);
  T1 = (1.0 / (c1 + c2*logR3 + c3*logR3*logR3*logR3));
  Tr = T1 - 273.15;

  // listen for incoming clients
  client = server.available();

  if (client)
    Serial.println("-> New Connection\n");
Serial.print("Tur: "); 
  Serial.print(" C  ");  
  Serial.print("Retur: "); 
  Serial.println(" C"); 
    // a http request ends with a blank line
    boolean currentLineIsBlank = true;

    while (client.connected())
      if (client.available()) {
        char c =;

        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank)

          client.print("<font color=blue size=5>");
          client.print("Tur: ");
          client.println("<p></font><font color=blue size=5>");
          client.print("Retur: ");

        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;

    // give the web browser time to receive the data

    // close the connection:
    Serial.println("   Disconnected\n");

P.S. i have allready triyed all i could find on internet about this.

Thank you all for your hints or help.

you can use ArduinoHttpClient library.

please use the EthernetENC library for new projects (I maintain both libraries)

Hi there. I managed to do what i wanted by adding the following:

 client.print("<iframe src='http://domain.tld/a/alin.php?tur=");
          client.print("' width='1' height='1' name='DataBox'>");

And now it send the data to my php file hosted on an external server and the php file inserts the data into mysql.

Now i have another problem: How do i make it to do this every x seconds? I triyed addng delay(5000); but if i do this it won't work.

Any sugestions?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.