Arduino - php post method connection problem

Hi! I’m trying send data to web from arduino. I have used this instruction.

I think I have did everything fine but it’s not working and i don’t understand the situtaion. I’m seeing everything is fine in serial monitor and I have used http://requestmaker.com like in my arduino code it’s working but arduino is not sending data to web server. So my codes :

ardunio .ino :

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

byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 }; // RESERVED MAC ADDRESS
EthernetClient client;

IPAddress dnServer(208, 67, 222, 222);

#define DHTPIN 8 // SENSOR PIN
#define DHTTYPE DHT11 // SENSOR TYPE - THE ADAFRUIT LIBRARY OFFERS SUPPORT FOR MORE MODELS
DHT dht(DHTPIN, DHTTYPE);

long previousMillis = 0;
unsigned long currentMillis = 0;
long interval = 250000; // READING INTERVAL

int t = 0;	// TEMPERATURE VAR
int h = 0;	// HUMIDITY VAR
String data;
String hum = "&hum1=";
String temp = "temp1=";

void setup() { 
	Serial.begin(9600);

	if (Ethernet.begin(mac) == 0) {
		Serial.println("Failed to configure Ethernet using DHCP"); 
	}

	dht.begin(); 
	delay(10000); // GIVE THE SENSOR SOME TIME TO START

	h = (int) dht.readHumidity(); 
	t = (int) dht.readTemperature(); 

	data = "";
}

void loop(){

	currentMillis = millis();
	if(currentMillis - previousMillis > interval) { // READ ONLY ONCE PER INTERVAL
		previousMillis = currentMillis;
		h = (int) dht.readHumidity();
		t = (int) dht.readTemperature();
	}

	data = temp + t + hum + h;
        Serial.println(data);

	if (client.connect("wwww.*****.net",80)) { // REPLACE WITH YOUR SERVER ADDRESS
                Serial.println("-> Connected");
                client.println("POST /add.php HTTP/1.1"); 
		client.println("Host: *****.net"); // SERVER ADDRESS HERE TOO
		client.println("Content-Type: application/x-www-form-urlencoded"); 
		client.println("Content-Length: "); 
		client.print(data.length()); 
		client.println(); 
		client.print(data); 
	} 
  else{
   Serial.println("basarsisiz");
  }

	if (client.connected()) { 
		client.stop();	// DISCONNECT FROM THE SERVER
	}

	delay(30000); // WAIT FIVE MINUTES BEFORE SENDING AGAIN
}

And I’m seeing in serial monitor this →

temp1=20&hum1=40
        -> connected

My add.php :

<?php
    // Connect to MySQL
    include("connect.php");

    // Prepare the SQL statement
    $SQL = "INSERT INTO tempLog (temperature ,humidity) VALUES ('".$_GET["serial"]."', '".$_GET["temperature"]."')";     

    // Execute SQL statement
    mysql_query($SQL);

    // Go to the review_data.php (optional)
    header("Location: index.php");
?>

So what is the wrong? As i say when i’m trying http://requestmaker.com like post method it’s working and i’m seeing data in website but arduino is not doing it.

I am working on this specific tutorial as well, but I don't have an ethernet shield, I am using a Yun.

I am partially through the tutorial and I have my SQL database up and working and I can enter data using POST method.

You appear as far along as I am. I have not actually tried to send data using the arduino.

Nevertheless, just looking at it, are you sure the SQL insert statement is correct?

'".$_GET["serial"]."', '".$_GET["temperature"]."'

Should it be

'".$_POST["temp1"]."', '".$_POST["hum1"]."'

I have no idea if that is correct?[/code][/code]

If you figure it out, please post back.

The problem was syntax errors and connection problems. I have fixed it and it works but now I have another problem. The client.connect() method is sometimes connecting sometimes not connecting. For example it was connected 2 times but not connected 12 times now. And as i say it’s randomly connect or not connect. What is the this problem?