Skip to content

Instantly share code, notes, and snippets.

@iqfareez
Created July 5, 2022 16:16
Show Gist options
  • Save iqfareez/4861c6e5dc76c1190d8b1651def13d37 to your computer and use it in GitHub Desktop.
Save iqfareez/4861c6e5dc76c1190d8b1651def13d37 to your computer and use it in GitHub Desktop.
#include <WiFi.h>
#include <Wire.h>
#include <HTTPClient.h>
#define AP_SSID "IIUM-Student"
#define AP_PASSWORD "" // leaves empty if open wifi
const String username = "1111111";
const String password = "blahblah";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// Connecting to the WIFI AP
WiFi.begin(AP_SSID, AP_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
// Login to Captive Portal
HTTPClient login;
login.begin("http://captiveportalmahallahgombak.iium.edu.my/cgi-bin/login");
String body = "user=" + String(username) + "&password=" + String(password) + "&cmd=authenticate&Login=Log%2BIn";
int res = login.POST(body);
Serial.println(res);
if (res == 200) {
Serial.println("Authentication IIUM successful");
}
login.end();
}
void loop() {
// put your main code here, to run repeatedly:
HTTPClient http;
http.begin("https://iqfareez.com/api/hello");
int res = http.GET();
Serial.println(res); // status code
Serial.println(http.getString()); // API response
delay(2000);
}
@Johanjj
Copy link

Johanjj commented Nov 6, 2023

@iqfareez Thank you for giving me sources and information.

@Johanjj
Copy link

Johanjj commented Nov 11, 2023

Hi, can I have your email? I'd like to discuss via email if allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment