Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <WiFi.h>
- #include <HTTPClient.h>
- int ph_value = 20;
- const char* ssid = "Shoaib";
- const char* password = "A01234567890";
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(115200);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
- Serial.println("IP Address");
- Serial.println(WiFi.localIP());
- }
- void loop() {
- HTTPClient http;
- http.begin("https://finalyearprojectnuml.000webhostapp.com/fyp.php");
- http.addHeader("Content-Type", "application/x-www-form-urlencoded");
- int httpResponseCode = http.POST(ph_value);
- if (httpResponseCode > 0) {
- String response = http.getString();
- Serial.println(httpResponseCode);
- Serial.println(response);
- }
- else {
- Serial.print("Error on sending post");
- Serial.println(httpResponseCode);
- }
- http.end();
- delay(2000);
- }
Add Comment
Please, Sign In to add comment