can not send data from ENC28j60 to PHP server

hi guys,

I have ENC28j60 connected with Arduino Nano and can get the IP address but I want to send the data to php file in my server domain in the internet, I tried this code but didn't send any thing!

I tried my link in Postman and works find but in Arduino Nano with ENC26j60 not sending!

the code I am using:

/*
   UIPEthernet TcpClient example.

   UIPEthernet is a TCP/IP stack that can be used with a enc28j60 based
   Ethernet-shield.

   UIPEthernet uses the fine uIP stack by Adam Dunkels <adam@sics.se>

        -----------------

   This TcpClient example gets its local ip-address via dhcp and sets
   up a tcp socket-connection to 192.168.0.1 port 5000 every 5 Seconds.
   After sending a message it waits for a response. After receiving the
   response the client disconnects and tries to reconnect after 5 seconds.

   Copyright (C) 2013 by Norbert Truchsess <norbert.truchsess@t-online.de>
*/
#include <UIPEthernet.h>
#include <ArduinoHttpClient.h>
#include "utility/logging.h"
EthernetClient client;
unsigned long next;
char serverAddress[] = "test.tech";  // server address
int port = 8080;

void setup() {
  Serial.begin(115200);
  uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
//  Ethernet.init(3); Serial.println("cs pin");
 Ethernet.begin(mac);

  Serial.println("Initiliazed");
  Serial.print(("localIP: "));
  Serial.println(Ethernet.localIP());
  Serial.print(("subnetMask: "));
  Serial.println(Ethernet.subnetMask());
  Serial.print(("gatewayIP: "));
  Serial.println(Ethernet.gatewayIP());
  Serial.print(("dnsServerIP: "));
  Serial.println(Ethernet.dnsServerIP());
  next = 0;
 

}
HttpClient client1 = HttpClient(client, serverAddress, port);
void loop()
{ 
  Serial.println("making GET request");
  client1.get("/Sensor/insert.php?temp=20&time=2020-08-10 19:58:46&Date=2020-08-10&Clock=19:58:46");
  int statusCode = client1.responseStatusCode();
  String response = client1.responseBody();
  Serial.print("Status code: ");
  Serial.println(statusCode);
  Serial.print("Response: ");
  Serial.println(response);
  Serial.println("Wait five seconds");
  delay(5000);
}

ANy Suggestion for my case :slight_smile:

thanks

what is in Serial Monitor?

Juraj:
what is in Serial Monitor?

this is in serial monitor:

localIP: 192.168.43.121
subnetMask: 255.255.255.0
gatewayIP: 192.168.43.1
dnsServerIP: 192.168.43.1
making GET request
Status code: -3
Response: 
Wait five seconds
making GET request
Status code: -3
Response: 
Wait five seconds
making GET request
Status code: -3
Response: 
Wait five seconds
making GET request
Status code: -3
Response: 

I added www. before domain: char serverAddress[] = "www.test.tech";

Then I got error 400 ?

Any Idea for this issue :slight_smile:

-3 is "timeout out". so it can't make a TCP connection.
400 is "bad request" returned by server

add client1.end()