How to do multiple HTTP GET with AT command ?

Hello everyone,

I’m trying to acces to somme url with my arduino, an esp8266 and AT command but i’m getting crazy …
After some memory problem with the string, i’m trying to figure out how can i do with AT command …
Please excuse my english (not my language).

String createUpdateUrl(String _intId , String _intValue) {
  String updId = _intId;
  String updValue = _intValue;
  updValue.replace(".",",");
  String url = String(F("GET /core/api/jeeApi.php?apikey=blablabla&type=virtual&id="));
  url.concat(updId);
  url.concat("&value=");
  url.concat(updValue);
  return url;
}
void updateServer(float _currentTemp,float _currentHumi,bool _lightState,bool _humiState,bool _heatState,String _gmode){
  notification(1,true);
  String updateValues[]={String(_currentTemp),String(_currentHumi),String(_lightState),String(_humiState),String(_heatState),_gmode};
  esp8266.println("AT+CIPSTART=4,\"TCP\",\"192.168.1.33\",80");
  recoitDuESP8266(1000);

  for(int i=0;i<6;i+=1){
        
        String url2 = createUpdateUrl(updateId[i],updateValues[i]);
        url2.concat(" HTTP/1.1\r\nHost: 192.168.1.33\r\nUser-Agent: ESP8266_HTTP_Client\r\nConnection: close\r\n\r\n");
        int tailleRequete = url2.length();
        Serial.print(url2);
        /*esp8266.print("AT+CIPSEND=4,");
        esp8266.println(tailleRequete);
        recoitDuESP8266(2000);
        delay(1000);
        esp8266.println(url2);
        recoitDuESP8266(2000);
        delay(1000);
        esp8266.println("AT+CIPSTATUS");
        recoitDuESP8266(2000);
        delay(5000);*/
  }  
  // Close all connections
  esp8266.println("AT+CIPCLOSE=5");
  recoitDuESP8266(1000);
  notification(1,false);
  }

here is a sample of my Serial output:

AT+CIPSTART=4,"TCP","192.168.1.33",80

4,CONNECT

OK
GET /core/api/jeeApi.php?apikey=mHpjghfbddffggfdffggfgdgdffdXulJRKeyqsMg&type=virtual&id=214&value=21,10 HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

GET /core/api/jeeApi.php?apikey=mHpPHjgrU90wG8n8RyOlHcW6fqRw3OH8wOvcXulJRKeyqsMg&type=virtual&id=215&value=58,40 HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

GET /core/api/jeeApi.php?apikey=mHpPHjghfdghhfdggffffulJRKeyqsMg&type=virtual&id=216&value=0 HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

GET /core/api/jeeApi.php?apikey=mHpPHjqrgergedrfvdrfdwvdfRw3OH8wOvcXulJRKeyqsMg&type=virtual&id=218&value=0 HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

GET /core/api/jeeApi.php?apikey=mHpPHjgsrgrsgrgrgRw3OH8wOvcXulJRKeyqsMg&type=virtual&id=217&value=0 HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

GET /core/api/jeeApi.php?apikey=mHpPHdfdfezzsfcW6fqRw3OH8wOvcXulJRKeyqsMg&type=virtual&id=220&value=Floraison HTTP/1.1
Host: 192.168.1.33
User-Agent: ESP8266_HTTP_Client
Connection: close

AT+CIPCLOSE=5

4,CLOSED

OK

I think my url are good, now i need to call them with AT command and i dont know how to dot it for multiple HTTP GET … :slight_smile:
Anyone has a clue ? :frowning:

  String url = String(F("GET /core/api/jeeApi.php?apikey=blablabla&type=virtual&id="));

You are STILL using Strings. There is NO excuse for using a String with fixed content.

Arrays of Strings are even worse.