browseURL not connecting to websites correctly

Added by Eisenhorn14 almost 5 years ago

Hi all,

I am currently using Arduino IDE 1.0.5-r2, an Arduino UNO rev 3, and DK electronics ethernet shield v2.0 with hardware controller enc28j60 and ethernet adapter HansRun HR911105A.

I have been trying to get the webClient example working. I have been following the example at, specifically this example, which is pretty much the exact same as the webClient example except with an actual website ( rather than My code can successfully find the ip of the website via dns, however, the website always returns “404 website not found”.

I believe the error is in the browseURL, but I will link all of my code. As well as a copy of the serial print out.

// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08


// ethernet interface mac address, must be unique on the LAN
static uint8_t mymac[] = { 0x38, 0xEE, 0xF4, 0x34, 0x94, 0x73 };

uint8_t Ethernet::buffer[700];
static uint32_t timer;

const char website[]= "";

// called when the client request is complete
static void my_callback (byte status, word off, word len) {
  Ethernet::buffer[off+300] = 0;
  Serial.print((const char*) Ethernet::buffer + off);

void setup () {

  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10)) 
    Serial.println( "Failed to access Ethernet controller");
  if (!ether.dhcpSetup())
    Serial.println("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 () {

  if (millis() > timer) {
    timer = millis() + 5000;
    Serial.print("<<< REQ ");
    ether.browseUrl(PSTR("/demo/"), "aphorisms.php", website, my_callback);
   //I have tried these other versions of ether.browseUrl as well:
   // ether.browseUrl(PSTR("/demo/aphorisms.php"), "", website, my_callback);
    //ether.browseUrl(PSTR(""), "/demo/aphorisms.php", website, my_callback);

Serial Print out:


<<< REQ 
<<< REQ >>>
HTTP/1.1 404 Not Found
Date: Wed, 04 Jun 2014 19:31:45 GMT
Server: Apache
Last-Modified: Mon, 14 Mar 2005 22:42:36 GMT
ETag: "40094544-556-3f24da0e68f00"
Accept-Ranges: bytes
Content-Length: 1366
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

Any ideas? I receive errors from any websites when I try to pull their html data down.
Thanks for any help!

Replies (1)

RE: browseURL not connecting to websites correctly - Added by tochinet almost 5 years ago

Maybe you should try to get some root page from a server first ?