Expected HTML GET response only with cookie statement; And I can't get data for my website

In this code, I'm just trying to send random data to make sure my code and website work properly. But I'm confused because the output was unexpected.

#include <WiFi.h>
#include <HTTPClient.h> //Board = Version 2.7.4
#include <ArduinoJson.h> //Library = arduinoJson 6.15.1
#include <LiquidCrystal_I2C.h> //Library LCD I2C
#include <OneWire.h>
#include <DallasTemperature.h>

const char* id_tracker= "1";
const char* ssid = "agung"; //masukkan ssid (hotspot/wifi)
const char* password = "agung123"; //masukkan password
byte server[] = {185,27,134,200};
const int oneWireBus = 4; //// GPIO where the DS18B20 is connected to
OneWire oneWire(oneWireBus); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire);
int indikator=LED_BUILTIN;

WiFiClient client;
const int httpPort = 80;
String url;

unsigned long timeout;
void setup () {

Serial.begin(115200);
//Begin serial communication Arduino IDE (Serial Monitor)

WiFi.begin(ssid, password);
pinMode (indikator, OUTPUT);
Serial.begin(115200);

while (WiFi.status() != WL_CONNECTED) {
Serial.println("Connecting..");
digitalWrite(indikator,HIGH);
delay(500);
digitalWrite(indikator,LOW);
}
if(WiFi.status() == WL_CONNECTED){
Serial.println("Connected!!!");
digitalWrite(indikator,HIGH);
delay(3000);
}
else{
Serial.println("Connected Failed!!!");
delay(1000);
}
}

void loop() {
int lat = random(1,100);
int lon = random(1,100);
int speed = random(1,100);

Serial.print("connecting to ");
if (!client.connect(server, httpPort)) {
Serial.println("connection failed");
}
url = "/Tracking/post/";
url += id_tracker;
url += "/";
url += lat;
url += "/";
url += lon;
url += "/";
url += speed;

Serial.print("Requesting URL: ");

// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: callista.id\r\n" +
"Connection: close\r\n\r\n");
timeout = millis();
while (client.available() == 0) {
if (millis() - timeout > 5000) {
Serial.println(">>> Client Timeout !");
client.stop();
return;
}
}

// Read all the lines of the reply from server and print them to Serial
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
Serial.println();
}

Unexpected Output =

connecting to Requesting URL: HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Nov 2022 12:01:53 GMT
Content-Type: text/html
Content-Length: 220
Connection: close
Vary: Accept-Encoding
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Cache-Control: no-cache

<html><body><script>document.cookie="_test=1ad7861f0938cdca04c04995b64a9309 ; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/" ;document.location.href="http://callista.id/Tracking/post/1/79/93/63?i=1";</script></body></html>
closing connection

I have merged your cross-posts @handrawinata27.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

...........................................................................
Help us help you.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Post a schematic.

Post an image of your project.

Which Micro Controller are you using?

Is this simulator code?

Please describe the problem better then you just did.

......................................................................

If you are using a 9V battery like this.


Don't.

.................................................................

Info about multi things

.......................................................................................................................

I2C scanner

https://www.arduino.cc/reference/en/libraries/i2cscanner/

What did the I2C scanner report?

.........................................................................................
Bread board power rail split


...............................................................................................................................................
Serial Input basics.

................................................................................................................

The search box is a useful tool.


For instance using the words "9v battery" in the search box one could find lots of reasons why this may be a bad idea.

Other search words include "level shifter",
.........................................................................................................

code merging

..........................................................................................................

disclaimer

The events portrayed in this post are not all true. The names are not real names of real people and real organizations.
..............................................................................

the output looks like a normal html response

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.