Enc28j60 .browseUrl() with local IP

Hello!
I’m using a Arduino Uno R3 and a Enc28j60 with the EtherCard.h-library from https://github.com/jcw/ethercard.
When I’m trying the example program “webClient” the board gets online and downloads a web page, but when I try to do almost the same (but without going online, just on my LAN) nothing gets to my local web server.

I think the problem lies in that I don’t really know how to use the method ether.browseUrl() when I only got a plain IP-adress instead of a full URL like in the example. I have attached the code that I have come up with that don’t work for me.

This is want I think is wrong: ether.browseUrl(PSTR("/index.php"), "", NULL, my_result_cb);

Does anyone here have an idea of what I should do to get this working?

#include <EtherCard.h>

static byte mymac[] = { 0x54, 0xD9, 0xFE, 0xDD, 0xFF, 0xE0 };
static byte myip[] = { 192, 168, 0, 91 };
static byte hisip[] = { 192, 168, 0, 16 };
static byte mymask[] = { 255, 255, 255, 0 };

byte Ethernet::buffer[700];

unsigned long previousMillis = 0;

void setup() {
  Serial.begin(9600);
  
  ether.begin(sizeof Ethernet::buffer, mymac);    
  ether.staticSetup(myip);
  ether.copyIp(ether.mymask, mymask);
  ether.copyIp(ether.hisip, hisip); // Selects the IP 192.168.0.16 to be used with the .browseUrl-method.

// Prints out the current IP-settings  
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("Server: ", ether.hisip);
}

void loop() {
  unsigned long currentMillis = millis();
// Needed for response to ICMP-pings  
  ether.packetLoop(ether.packetReceive());

// Every 5th second it makes a HTTP-request to index.php on server 192.168.0.16
  if(currentMillis - previousMillis > 5000) {
    ether.browseUrl(PSTR("/index.php"), "", NULL, my_result_cb);
    Serial.println("Sending a request...");
    
    previousMillis = currentMillis;    
  }  
}

// Function to output the response from the web server
static void my_result_cb (byte status, word off, word len) {
  Serial.print("<<< reply ");
  Serial.println((const char*) Ethernet::buffer + off);
}
ether.browseUrl(PSTR("/index.php"), "", NULL, my_result_cb);

You provide a NULL parameter as the hostname. How do you expect the Arduino to know what to use for this field?

I guess you don't have local host names so just provide the IP, in your case "192.168.0.16" might work, but that depends on your webserver setup.

I forgot to mention that I have also tried:

ether.browseUrl(PSTR("/index.php"), "", "192.168.0.16", my_result_cb);

Without any success… The function “my_result_cb” doesn’t even get run.

I read somewhere online that the NULL-parameter would be used when “ether.hisip” is set to the destination IP, but none of these variants work for me :~

What's in your server's log? Nothing? Run WireShark on the PC to sniff the whole network traffic. Do you see anything come into your PC's network interface?

ether.begin(sizeof Ethernet::buffer, mymac);
ether.begin(sizeof Ethernet::buffer, mymac,10);
try this

I got it.
Use this method.

ether.hisip[0] = 192;
ether.hisip[1] = 168;
ether.hisip[2] = 0;
ether.hisip[3] = 16;

Disable DNSloopup if any.