Skip to content

Instantly share code, notes, and snippets.

@ajangrahmat
Created December 14, 2022 07:29
Show Gist options
  • Save ajangrahmat/1ac6a507800b3a8fb4c2e7e30d254aed to your computer and use it in GitHub Desktop.
Save ajangrahmat/1ac6a507800b3a8fb4c2e7e30d254aed to your computer and use it in GitHub Desktop.
#include <WiFi.h>
const char* ssid = "isi nama wifi";
const char* password = "isi password wifi";
WiFiClient client;
#include <ArduinoHttpClient.h>
char serverAddress[] = "test.kelasrobot.com";
int port = 80;
HttpClient client1 = HttpClient(client, serverAddress, port);
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500); Serial.print(".");
}
Serial.println(WiFi.localIP());
}
void loop() {
String path = "/test.php";
client1.get(path);
int statusCode = client1.responseStatusCode();
String response = client1.responseBody();
Serial.print("Status code: ");
Serial.println(statusCode);
Serial.print("Response: ");
Serial.println(response);
delay(5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment