title: sending variable,which is read by arduino, to php script(electronic toll collection system)
body: <p>I am building electronic toll colection system using arduino which rfid based;i want to send the "unique id" of the tag(read by arduino) to php script(stored on local apache server root folder).i have written the code please point out the mistakes and also have a look on the ethernet settings whether they are correct in the program..</p>
  
  <pre><code>#include &lt;SPI.h&gt;
  #include &lt;Ethernet.h&gt;
  EthernetServer server(80);
  byte mac[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  IPAddress gateway(192,168,1,1);
  IPAddress subnet(255,255,255,0);
  IPAddress ip(192,168,1,4);
  EthernetClient client;
  int  val = 0; 
  char code[10]; 
  int bytesread = 0; 
  void setup() 
  { 
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600); 
  pinMode(2,OUTPUT);   
  digitalWrite(2, HIGH);                 
  }  
  
   void loop() &lt;br&gt;
  { 
   if(Serial.available() &gt; 0) {          
      if((val = Serial.read()) == 10) {   
        bytesread = 0; 
        while(bytesread&lt;10) {             
          if( Serial.available() &gt; 0) { 
            val = Serial.read();
            if((val == 10)||(val == 13)) {  
              break;                       
            } 
            code[bytesread] = val;               
            bytesread++;                   
          }
        } 
        if(bytesread == 10) {             
         client.print("GET try.php?code=");
        client.print(code);
  
  client.println(" HTTP/1.1");
  client.println("Host: localhost");  
  client.println();        
        } 
        bytesread = 0; &lt;br&gt;
        digitalWrite(2, LOW);                  
             delay(1500);                       
             digitalWrite(2, HIGH);                  // Activate the RFID reader
      } 
    } 
  }
  the php script:
  
  &lt;?php   
  $variable = $_GET['code']
  echo  "code is  $variable ";
  ?&gt;
  </code></pre>