Arduino can not response to web requests without Processing IDE

I want to control an LED through website, I used Processing program and every thing work just fine. but when I unplugged my arduino from the laptop, the arduino can not response to the request from the web. It works otherwise. I don’t want to connect my arduino all the time to my lap top.

I have a file called LEDstate.txt which sends data include 0 or 1 to the Processing program, and I have simple html page with ON OFF hyperlinks include the state of the txt file.

these are the codes I have used

The code for the Processing program

import processing.serial.*;
 Serial port;

 void setup()  {
 /*  change the number between the brackets after Serial.list() to meet the PORT number that arduino is connected to */

    port = new Serial(this, Serial.list()[1], 9600); 
 void draw() {

  String LED_Status[] = loadStrings(""); 

  if (LED_Status[0].equals("1") == true) {
    println("LEDstate.txt have ( 1 )- sending 'H' to Arduino ");

 else {
    println("LEDstate.txt have ( 0 )- sending 'L' to Arduino ");

  delay(1000); // This makes a 5 sec delay between each check for the value that is stored in LED.txt

and this the arduino IDE code

int Led = 13;  // led is connected to pin number 12

int incomingByte; // variable to read the incoming serial data coming from "Processing" sketch through USB cable

void setup() {
  pinMode(Led, OUTPUT);

void loop() {

  if (Serial.available() > 0) {  // checking if there is incoming serial data

    incomingByte =;  // reading the incoming data from "Processing"

    if (incomingByte == 'H') { // if "Processing"" is sending H , turn on the LED 
      digitalWrite(Led, HIGH);   }

    if (incomingByte == 'L') {  // if "Processing" is sending L , turn off the LED 
      digitalWrite(Led, LOW);  }

and this is the php code for the request

$onoroff = $_GET["state"]; // Declares the request from index.html as a variable
$textfile = "LEDstate.txt"; // Declares the name and location of the .txt file

$fileLocation = "$textfile";
$fh = fopen($fileLocation, 'w   ') or die("Something went wrong!"); // Opens up the .txt file for writing and replaces any previous content
$stringToWrite = "$onoroff"; // Write either 1 or 0 depending on request from index.html
fwrite($fh, $stringToWrite); // Writes it to the .txt file

header("Location: index.html"); // Return to frontend (index.html)

Asking the obvious maybe... But how is your Arduino connected to the web? I don't see anything in your code that shows connections except for serial