Need multiple "HTTP Get Request"

Sorry, I'm kind of new to this Arduino and writing programs; I'm having a problem with programming
My arduino is suppose to get input from sensor
then once the sensor detects; the LED goes HIGH
Once it goes high, it suppose to send HTTP GET Request using function.
and i have PHP file which will insert a record into the database within my wampserver

As a result, it did send the HTTP GET Request but it only send once (the first time).
Once the LED goes LOW it would not send the HTTP GET Request.
I have tried and looked over google so that it could send every time the function is being called

Here is my code:

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

#define trigPin1 13
#define echoPin1 12
#define led1 10
#define led2 11
#define led3 9

byte mac[] = {0xDE,0xAD,0xBE,0xEF,0xFE,0xED};
EthernetClient client;
IPAddress ip(192,168,0,196);

volatile int state1 = LOW;

int count1 = 0;


void setup() {
  Serial.begin(9600);
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  pinMode(led1, OUTPUT);
  
  EthernetSetup();
}

void loop() {
  sensor1();
  delay(500);
}

void sensor1() {
  long duration1, distance1;
  digitalWrite(trigPin1, LOW);  
  delayMicroseconds(2); 
  digitalWrite(trigPin1, HIGH);
  delayMicroseconds(10); 
  digitalWrite(trigPin1, LOW);
  duration1 = pulseIn(echoPin1, HIGH);
  distance1 = (duration1/2) / 29.1;
  if (distance1 < 13)  
  { 
    count1++;
    if(count1>5 && state1==0) 
    {
      state1 = 1;
      count1 = 0;
      SEND_TO_PHP(1);
      Serial.println(state1);
    }
  }
  else
  {
    if(state1==1) 
    { 
      state1 = 0; 
      count1 = 0; 
      SEND_TO_PHP(0); 
      Serial.println(state1);
    }
  }
  digitalWrite(led1,state1);
}

void EthernetSetup()
  {
  if (Ethernet.begin(mac) == 0)
    Serial.println("Failed to configure Ethernet using DHCP");
  else Serial.println("Ethernet Begin (MAC) passed");

  Serial.print("Current IP : ");
  Serial.println(Ethernet.localIP());

  delay(1000);
  Serial.println("connecting...");

  if (client.connect(ip,80))
    Serial.println("connected");
}

void SEND_TO_PHP(int data){//HTTP request
  // SEND MAC ADDRESS AND IP to WEB SERVER
  Serial.println(data);
  
  if(data==1)
  client.println("GET /sensor/sensor.php?data=1");
  else if(data==0)
  client.println("GET /sensor/sensor.php?data=0");
  
  client.println(" HTTP/1.1");
  client.println("Host: localhost");
  client.println("Accept: text/html");
  client.println("Connection: close");
  client.println();
  Serial.println();
  Serial.println("data sent");
  readc();
  data = 0;
  client.flush();// flush ethernet before stop
  client.stop();
}
void readc()
{
  int a = 0;
  while (client.connected())
  { Serial.println("con");
     if (client.available())
     { Serial.println("ava");
       char c = client.read();
       Serial.print(c);
     }   
  }
}

And here is my PHP file:

<?php
require_once('config.inc.php');
require_once('function.inc.php');
session_start();

$link = mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
mysql_select_db(DB_DATABASE,$link) or die("Could not connect database");

// Check connection
if (mysqli_connect_errno()) {	
	printf("Unable to connect to database: %s", mysqli_connect_error());
	exit();}

$sql= "INSERT INTO spotreal(data) VALUES('$_GET[data]')";
mysql_query($sql,$link);

echo "1 record added";
?>

Thank you in advance.

Here is an example sketch that sends a request for a page every 30 seconds. Use the GET method.
http://playground.arduino.cc/Code/WebClient

  sensor1();

The name says NOTHING about what the function does.

  client.println("GET /sensor/sensor.php?data=0");
  
  client.println(" HTTP/1.1");

The GET should be sent using client.print(). The HTTP part should be sent BEFORE the cr/lf sent by the println() method.

The Host record is not needed, unless you are hosting multiple domains - unlikely, since localhost means the serving running on this computer (the Arduino). And, that is not the machine you are actually sending the request to.

Thank you to all the reply; I actually found out the answer by myself.

The answer to this issue is that
every time I'm going to call an HTTP GET Request, i suppose to connect to the server every time;
in which i had forgotten.

I'm trying to carry out two successive HTTP GET using the following code.
if (client.connect(server, 3480)) {
client.print("GET /data_request?id=variableset&DeviceNum=125&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&&Variable=CurrentTemperature");
client.print("&Value=");
client.print(temperature,1);
client.println(" HTTP/1.0");
client.print("&&");

client.print("GET /data_request?id=variableset&DeviceNum=127&serviceId=urn:micasaverde-com:serviceId:HumiditySensor1&Variable=CurrentLevel");
client.print("&Value=");
client.print(humidity,0);
client.println(" HTTP/1.0");
client.println();

}
else {
//if there is no connection
Serial.println("Connection Error");
}
//stop connection with VERA
client.stop();
}

Unfortunately the second GET command does not get across. Have I made a syntax error or shall this always be done through an individual connection each time. I had thought that using client.print("&&"); I could have successive GET commands.
Any advice would be appreciated.

You must use a "Connection: Keep-Alive" or close the first connection and establish another. The Keep-Alive is more difficult to maintain. The new connection is slower.

@SurferTim, I take it this is what you meant? However, still only one (first GET) data is coming through. Where did I make a mistake?

if (client.connect(server, 3480))
{

client.print("GET /data_request?id=variableset&DeviceNum=125&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&&Variable=CurrentTemperature");
client.print("&Value=");
client.print(temperature,1);
client.println(" HTTP/1.0");
client.println("Connection: Keep-Alive");

client.print("GET /data_request?id=variableset&DeviceNum=127&serviceId=urn:micasaverde-com:serviceId:HumiditySensor1&Variable=CurrentLevel");
client.print("&Value=");
client.print(humidity,0);
client.println(" HTTP/1.0");
client.println();
client.stop();
}
else
{
//if there is no connection
Serial.println("Connection Error");
client.stop();