code is webClient for arduino in this library
#include <SPI.h>
#include <EtherCard_STM.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "82.221.41.158";
// called when the client request is complete
static void my_callback (byte status, uint16_t off, uint16_t len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/comprueba_maq_ON.php?maquina="), "1", website, my_callback); }
}
The Wiznet chip is much more reliable (my experience) and the lib for that is better supported.
The W5500 module prices are also competitive with those of ENC module: https://www.aliexpress.com/item/Replace … 56354.html
[Vassilis – Wed Feb 14, 2018 3:16 pm] –
@ramgc The IP in your sketch (82.221.41.158) is not functional (at least to me). Please provide us with a sketch that uses a valid public IP or public domain name.
ok, thanks
#include <SPI.h>
#include <EtherCard_STM.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "82.223.11.159";
// called when the client request is complete
static void my_callback (byte status, uint16_t off, uint16_t len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/comprueba_maq_ON.php?maquina="), "1", website, my_callback); }
}
Pinging 82.223.11.159 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 82.223.11.159:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
[Vassilis – Wed Feb 14, 2018 4:04 pm] –
Pinging 82.223.11.159 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.Ping statistics for 82.223.11.159:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
i just see that dont ping… but php work properly
put http://82.223.11.159/comprueba_maq_ON.php?maquina=1 and return 1 or 0
i dont know that happen
https://github.com/UIPEthernet/UIPEthernet
#include <SPI.h>
#include <EtherCard_STM.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "82.223.11.159";
static byte server_ip[] = { 82,223,11,159};
// called when the client request is complete
static void my_callback (byte status, uint16_t off, uint16_t len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
if (ether.begin(sizeof Ethernet::buffer, mymac, PA4) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
//if (!ether.dnsLookup(website))
// Serial.println("DNS failed");
ether.copyIp(ether.hisip, server_ip);
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/comprueba_maq_ON.php?maquina="), "1", website, my_callback); }
}
[Vassilis – Wed Feb 14, 2018 5:52 pm] –
#include <SPI.h>
#include <EtherCard_STM.h>// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };byte Ethernet::buffer[700];
static uint32_t timer;const char website[] PROGMEM = "82.223.11.159";
static byte server_ip[] = { 82,223,11,159};// called when the client request is complete
static void my_callback (byte status, uint16_t off, uint16_t len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));if (ether.begin(sizeof Ethernet::buffer, mymac, PA4) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);//if (!ether.dnsLookup(website))
// Serial.println("DNS failed");ether.copyIp(ether.hisip, server_ip);
ether.printIp("SRV: ", ether.hisip);}
void loop () {
ether.packetLoop(ether.packetReceive());if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/comprueba_maq_ON.php?maquina="), "1", website, my_callback); }
}

As I said before, this is a very basic code example and can be improved a lot (ring buffer etc).
#include <SPI.h>
#include <EtherCard_STM.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
#define MY_BUFFER_SIZE 2048
byte buf[MY_BUFFER_SIZE];
int tail = 0;
const char website[] PROGMEM = "82.223.11.159";
static byte server_ip[] = { 82,223,11,159};
// called when the client request is complete
static void my_callback (byte status, uint16_t off, uint16_t len) {
if((tail + len) < MY_BUFFER_SIZE){
for(int i=0;i<len;i++){
buf[tail++] = Ethernet::buffer[off + i];
}
}
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
if (ether.begin(sizeof Ethernet::buffer, mymac, PA4) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
//if (!ether.dnsLookup(website))
// Serial.println("DNS failed");
ether.copyIp(ether.hisip, server_ip);
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if(tail > 0){
Serial.println(">>>");
for(int i=0;i<tail;i++){
Serial.write(buf[i]);
}
tail = 0; //Clear the buffer
}
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/comprueba_maq_ON.php?maquina="), "1", website, my_callback); }
}
Great forum, thanks thanks!!
now only have to process all bytes