 
 int req[CHANNELS];
 char buff[BUFFER_SIZE+1];
+
+#define MAX_APNAME 64
+typedef struct NParams {
+  char APNAME[MAX_APNAME+1]="";
+  char APIP[3*4+3+1]="";
+  char JAPNAME[MAX_APNAME+1]="";
+  char STAIP[3*4+3+1]="";
+};
 
 const char PROGMEM headers_A[BUFFER_SIZE] = "Content-Type: text/html\r\nCache-Control: no-cache, no-store, must-revalidate\r\n";
 const char PROGMEM headers_B[BUFFER_SIZE] = "Pragma: no-cache\r\nExpires: -1\r\n\r\n";

      netsend(n, buff);
      token = strtok(NULL, "\t");
    }
    netsend_P(n, PSTR("</ul><form method='GET'><label>Connect to network:</label>"));
    netsend_P(n, PSTR("<input type='text' placeholder='network' name='n'/>"));
    netsend_P(n, PSTR("<input type='text' placeholder='password' name='p'/>"));
    netsend_P(n, PSTR("<input type='submit' value='Connect/Disconnect'/></form>"));

          //DEBUG_SERIAL.println("CWLAP char at");
          //DEBUG_SERIAL.println(i);
        }
      }
    }
  }
}

void callbackIP(char* line, void* context) {
  NParams* p = (NParams*)context;
  int o = 0;
  int max = 0;
  char* dst = NULL;
  if (memcmp_P(line, PSTR("+CWSAP_CUR:\""), 12)==0) {
    o = 12;
    max = MAX_APNAME;
    dst = p->APNAME;
  } else if (memcmp_P(line, PSTR("+CWJAP_CUR:\""), 12)==0) {
    o = 12;
    max = MAX_APNAME;
    dst = p->JAPNAME;
  } else if (memcmp_P(line, PSTR("+CIFSR:APIP,\""), 13)==0) {
    o = 13;
    max = 3*4+3+1;
    dst = p->APIP;
  } else if (memcmp_P(line, PSTR("+CIFSR:STAIP,\""), 14)==0) {
    o = 14;
    max = 3*4+3+1;
    dst = p->STAIP;
  }
  if (dst != NULL) {
    for (int i = o; i-o < max; i++) {
      if (line[i] == '"') {
        break;
      } else {
        dst[i-o]=line[i];
        dst[i-o+1]=0;
      }
    }
  }
