Search code examples
urlarduinoethernet

Arduino Ethernet Client not working using IP address only


I am trying to communicate with my hosted server using an Arduino Ethernet shield.

Now the problem is this:

Using a web browser, I can see that calling the URL works fine, but calling the IP address does not. I assume that the hosting provider hosts several different URLs using the same IP address.

How can I make a URL dependent call from within the Arduino libraries? The standard Arduino libraries only require the IP address of my host, not the URL.


Solution

  • You need to ensure the http GET/POST request has the correct Host field. Here's a sample get request from http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html

    There's a lot of good technical information on this site.

    Sample HTTP Get Request:

     GET /pub/WWW/TheProject.html HTTP/1.1
     Host: www.w3.org
    

    This may require some customization of your code, but should do the trick !!