Using esp 01 module. Send HTTP request with AT command.

hello guys.
it is simple question.

i am using esp 01 module and it can join my wireless network.
also i am updating my sensor data to ThingSpeak.

now i just want to get a current time.
many guys know Timezonedb.
i really want to use that api.
i got a key and i know api of timezonedb, but i do not know how to send api.
i have controlled esp module by only AT command, so can i send api with AT command from esp?
and is it possible, how can i send that?
waiting any reply.

  • i can not use WiFi library. because i may be newbie of arduiino i do not know use that.. :frowning:

solved.
simple code here.

#define SSID "SSID"
#define PASS "PW"
#define TIME_IP "api.timezonedb.com"

void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
Init();
}

void loop()
{
updateTS();
delay(100000);
}
//
int updateTS()
{
String res;
String subStr;
int index;
String cmd = "AT+CIPSTART=1,"TCP","";// Setup TCP connection
cmd += TIME_IP;
cmd += "",80";
Serial3.println(cmd);
delay(2000);
if ( Serial.find( "Error" ) )
{
Serial3.print( "RECEIVED: Error\nExit1" );
return -1;
}
delay(100);
String cmd1 = "GET /v2/get-time-zone?key=!!KEY!!&format=json&by=zone&zone=Asia/Seoul HTTP/1.1";
String cmd2 = "Host: api.timezonedb.com";
String cmd3 = "Connection: keep-alive";

Serial3.print( "AT+CIPSEND=1," );
Serial3.println("137");
if (Serial3.find(">"))
{
Serial.println("Ready");
}
Serial3.println(cmd1);
Serial3.println(cmd2);
Serial3.println(cmd3);
Serial3.println();
delay(500);
res = Serial3.readString();
index = res.indexOf("formatted");
subStr = res.substring(index+12, index+28);
Serial.print(subStr);
//Serial.print(res);
Serial3.println( "AT+CIPCLOSE" );//close TCP connection
return 0;
}

void Init()
{
Serial3.println("AT");
if (Serial3.find("OK"))
Serial.println("Ready.");

Serial3.println("AT+CWMODE=3");//WiFi STA mode - if '3' it is both client and AP
delay(2000);
//Connect to Router with AT+CWJAP="SSID","Password";
// Check if connected with AT+CWJAP?
String cmd = "AT+CWJAP=""; // Join accespoint
cmd += SSID;
cmd += "","";
cmd += PASS;
cmd += """;
Serial3.println(cmd);
delay(5000);

if (Serial3.find("OK"))
{
Serial.println("WiFi connected");
}
else
{
Serial.println("WiFi Not connected");
}
Serial3.println("AT+CIPMUX=1");
delay(1000);
}