continuous HTTP get requests hangs arduino nano

Hi all of you,
I am using w5100 module and arduino nano …i have rfid reader with wiegand out …when punch occurs arduino sends the GET HTTP request and reads the response with HTML headers…I only read the response body line (actual data)…All working good but when i continuously make punches… it hangs or responding too late …
code:

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

#include "pins_arduino.h"

#define ID_LEN 26
#define DATA_PIN_0 4
#define DATA_PIN_1 5
#include <SPI.h>
#include <Ethernet.h>

// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
IPAddress gateway( 192, 168, 10, 3);
IPAddress subnet( 255, 255, 255, 0 );
IPAddress dns1( 59, 144, 127, 16);
//IPAddress server(192, 168, 10, 191);
IPAddress ip(192, 168, 10, 11);
//char server[] = "https://test-turnstile.gymshim.com";
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
IPAddress server(192, 168, 10, 191);
EthernetClient client;

//////////////////////

volatile uint8_t *port_to_pcmask[] = { &PCMSK0, &PCMSK1, &PCMSK2 };
typedef void (*voidFuncPtr)(void);
volatile static voidFuncPtr PCintFunc[24] = { NULL };
volatile static uint8_t PCintLast[3];

////////////////////////////////////////
// attach an interrupt to a specific pin using pin change interrupts.
void PCattachInterrupt(uint8_t pin, void (*userFunc)(void), int mode)
{

  uint8_t bit = digitalPinToBitMask(pin);
  uint8_t port = digitalPinToPort(pin);
  uint8_t slot;
  volatile uint8_t *pcmask;

  if (mode != CHANGE)
  {
    return;
  }

  // map pin to PCIR register
  if (port == NOT_A_PORT)
  {
    return;
  }
  else
  {
    port -= 2;
    pcmask = port_to_pcmask[port];
  }

  slot = port * 8 + (pin % 8);
  PCintFunc[slot] = userFunc;

  // set the mask
  *pcmask |= bit;

  // enable the interrupt
  PCICR |= 0x01 << port;

}

////////////////////////////////////////
void PCdetachInterrupt(uint8_t pin)
{
  uint8_t bit = digitalPinToBitMask(pin);
  uint8_t port = digitalPinToPort(pin);
  volatile uint8_t *pcmask;

  // map pin to PCIR register
  if (port == NOT_A_PORT)
  {
    return;
  }
  else
  {
    port -= 2;
    pcmask = port_to_pcmask[port];
  }

  // disable the mask.
  *pcmask &= ~bit;

  // if that's the last one, disable the interrupt.
  if (*pcmask == 0)
  {
    PCICR &= ~(0x01 << port);
  }
}

////////////////////////////////////////
// common code for isr handler. "port" is the PCINT number.
// there isn't really a good way to back-map ports and masks to pins.
static void PCint(uint8_t port)
{
  uint8_t bit;
  uint8_t curr;
  uint8_t mask;
  uint8_t pin;

  // get the pin states for the indicated port.
  curr = *portInputRegister(port + 2);
  mask = curr ^ PCintLast[port];
  PCintLast[port] = curr;

  // mask is pins that have changed. screen out non pcint pins.
  if ((mask &= *port_to_pcmask[port]) == 0)
  {
    return;
  }

  // mask is pcint pins that have changed.
  for (uint8_t i = 0; i < 8; i++)
  {
    bit = 0x01 << i;
    if (bit & mask)
    {
      pin = port * 8 + i;
      if (PCintFunc[pin] != NULL)
      {
        PCintFunc[pin]();
      }
    }
  }
}

////////////////////////////////////////
SIGNAL(PCINT0_vect)
{
  PCint(0);
}

////////////////////////////////////////
SIGNAL(PCINT1_vect)
{
  PCint(1);
}

////////////////////////////////////////
SIGNAL(PCINT2_vect)
{
  PCint(2);
}

////////////////////////////////////////////////////////
// end of interrupt code
////////////////////////////////////////////////////////

volatile long reader1 = 0;
volatile int reader1Count = 0;

////////////////////////////////////////
void read0(void)
{
  if (digitalRead(DATA_PIN_0) == LOW)
  {
    reader1Count++;
    reader1 = reader1 << 1;
    // Serial.print("0");
  }
}

////////////////////////////////////////
void read1(void)
{
  if (digitalRead(DATA_PIN_1) == LOW)
  {
    reader1Count++;
    reader1 = reader1 << 1;
    reader1 |= 1;
    //Serial.print("1");
  }
}


void setup() {

  // Open serial communications and wait for port to open:
 
  PCattachInterrupt(DATA_PIN_0, read0, CHANGE);//Attachinterrupt D0
  PCattachInterrupt(DATA_PIN_1, read1, CHANGE);//Attachinterrupt D1

  delay(10);

  // the interrupt in the Atmel processor misses out the first negative pulse as the inputs are already high,
  // so this gives a pulse to each reader input line to get the interrupts working properly.
  // Then clear out the reader variables.
  // The readers are open collector sitting normally at a one so this is OK
  for (int i = 4; i < 8; i++)
  {
    pinMode(i, OUTPUT);
    digitalWrite(i, HIGH); // enable internal pull up causing a one
    digitalWrite(i, LOW);  // disable internal pull up causing zero and thus an interrupt
    pinMode(i, INPUT);
    digitalWrite(i, HIGH); // enable internal pull up
  }

  delay(10);

  // clear the reader input variables
  reader1 = 0;
  reader1Count = 0;





  //Initialize USBSerial and wait for port to open:
  Serial.begin(9600);
  while (!Serial); delay(10);
  Ethernet.begin(mac, ip, dns1, gateway, subnet);
  delay(500);
  Serial.println(F("Please Give Your Punch")); // what to do to test

  // if you get a connection, report back via serial:
}

void loop() {
  if (reader1Count >= ID_LEN)
  {
    Serial.println(F(""));
    Serial.println(F("---------------------"));
    Serial.print(F("data: "));
    unsigned long Reader = ((reader1 & 0xfffffff) >> 1); //actual data
    char dataBuffer[10];
    sprintf(dataBuffer, "%08u", Reader); //pad zeroes and make string
    Serial.println(dataBuffer);
    Serial.println(F("---------------------"));

    sendGET();

    reader1 = 0;
    reader1Count = 0;

  }
}



void sendGET()
{
  if (client.connect(server, 8088)) {  //starts client connection, checks for connection
    Serial.println(F("connected"));


    client.print(String("GET ") + "/api/values/1" + " HTTP/1.1\r\n" +
                 "Host:192.168.10.191" + "\r\n" +
                 "Connection: close\r\n\r\n");

    Serial.println(F("request sent"));


  }
  else {
    Serial.println(F("connection failed")); //error message if no client connect
    Serial.println();
  }

  //  if (client.connected() && client.available()) {
  //    char c = client.read();
  //    Serial.print(c);
  //  }

  String line ;
  int lines_received = 0;
  while (client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available

    line = client.readStringUntil('\r');
    //Serial.print(line);
    if (lines_received == 12) {
      // Serial.print(line);
      line.substring(1, line.length());


      char charBuf[50];
      line.toCharArray(charBuf, 1024) ;
      int length = strlen(charBuf);
      charBuf[length - 1] = '\0';
      char end_char = charBuf[strlen(charBuf) - 1]; ;
      Serial.print(F("Received:"));
      Serial.println(charBuf);
      Serial.print(F("Received:"));
      Serial.println(end_char);

      if (end_char == '1') {
        Serial.println(F("Plz open the Turnstile"));

      }
      else {
        Serial.println(F("Wrong Entry"));

      }



    }
    lines_received++;
  }

  client.stop();
  Serial.println(F("client disconnected."));
}

output:

---------------------
data: 00008969
---------------------
connected
request sent
Received:
"123-1234-1
Received:1
Plz open the Turnstile
client disconnected.
digitalWrite(i, LOW);  // disable internal pull up causing zero and thus an interrupt

Might cause a LOW and might fire the interrupt. No guarantee. If you want to fire for sure then make it an output when you do this.

Taking off the pullup causes a floating pin, not a LOW condition.

client.print(String("GET ") + "/api/values/1" + " HTTP/1.1\r\n" +
                 "Host:192.168.10.191" + "\r\n" +
                 "Connection: close\r\n\r\n");

All that use of the + operator on String class objects is going to shoot your heap full of holes. Memory starts looking like swiss cheese. Once the little nano gets into a state where it can't find a block large enough to store the new String the program crashes.

The question is why? Why not:

client.print("GET/api/values/1 HTTP/1.1\r\nHost:192.168.10.191\r\nConnection: close\r\n\r\n");

This could be what's happening when you give it too many cards. It makes too many Strings and you crash.

The String class is a thing to be avoided on a microcontroller, double especially on one with as little memory as a Nano.

this is ok when to send whole hardcoded string but when to input any data through api say databuffer string from code then how to send without string typecasted?

Just break it into multiple client.print lines. It doesn't have to be all strung together into one string and sent in one line of code.

Or build it with regular string functions like strcat and sprintf.

Or, hell stick with String class if you don't mind the crashes. I'm not telling you that you can't use it. If you really want to and don't mind the crashes then go ahead.

Yes tried but it is stuck at the client.connect function:

  if (client.connect(server, 8088)) {  //starts client connection, checks for connection
    Serial.println(F("connected"));
    client.print("GET /api/values/1 HTTP/1.1\r\nHost:192.168.10.191\r\nConnection: close\r\n\r\n");
    Serial.println(F("request sent"));
  }

output stuck at and late response:

---------------------
data: 00008969
---------------------
connected
request sent

I may have erred when I edited that line. I wasn't being particularly careful. The point remains that the String class is a bad idea on your nano. Check and make sure you're sending the right string.

is arduino capable for continuous and frequent GET requests like above?

Yes. If you write good code for it.