# can not send data from ENC28j60 to PHP server

**URL:** <https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970>\
**Category:** Networking, Protocols, and Devices\
**Created:** [August 13, 2020, 5:56pm UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970 "2020-08-13T17:56:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MKSaeed](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MKSaeed](https://forum.arduino.cc/u/MKSaeed)\
**Post date:** [August 13, 2020, 5:56pm UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/1 "2020-08-13T17:56:59Z")

</div>

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:

```cpp
/*
  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 🙂

thanks

---

<div class="post-metadata">

**Author:** ![Juraj](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/juraj/32/238785_2.png) [@Juraj](https://forum.arduino.cc/u/Juraj)\
**Post date:** [August 13, 2020, 6:19pm UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/2 "2020-08-13T18:19:25Z")

</div>

what is in Serial Monitor?

---

<div class="post-metadata">

**Author:** ![MKSaeed](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MKSaeed](https://forum.arduino.cc/u/MKSaeed)\
**Post date:** [August 13, 2020, 6:27pm UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/3 "2020-08-13T18:27:10Z")

</div>

> Juraj:  
> what is in Serial Monitor?

this is in serial monitor:

```Initiliazed
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: 

```

---

<div class="post-metadata">

**Author:** ![MKSaeed](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MKSaeed](https://forum.arduino.cc/u/MKSaeed)\
**Post date:** [August 13, 2020, 7:12pm UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/4 "2020-08-13T19:12:37Z")

</div>

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

Then I got error 400 ?

---

<div class="post-metadata">

**Author:** ![MKSaeed](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MKSaeed](https://forum.arduino.cc/u/MKSaeed)\
**Post date:** [August 14, 2020, 4:02am UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/5 "2020-08-14T04:02:17Z")

</div>

Any Idea for this issue 🙂

---

<div class="post-metadata">

**Author:** ![Juraj](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/juraj/32/238785_2.png) [@Juraj](https://forum.arduino.cc/u/Juraj)\
**Post date:** [August 14, 2020, 5:08am UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/6 "2020-08-14T05:08:40Z")

</div>

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

add client1.end()

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 11:21am UTC](https://forum.arduino.cc/t/can-not-send-data-from-enc28j60-to-php-server/669970/7 "2021-05-06T11:21:24Z")

</div>

Closed on May 6, 2021, 11:21am UTC


