Ethernet help needed

Hello!

I've got an ambitious project going on, trying to set the color of a BlinkM via a web page on my site. I've got a color-picker page that stores the selected color in a Mysql DB, and another page, 'color.php', that requests the most recent picked color and displays the HEX value.

The set up of my Arduino + ethernet shield is to scrape the color.php every 5 sec or so, and set the BlinkM to that color.

My problem is that I can't find a way to point my Arduino to the color.php page...

Using various tools, I am told that the IP of my site is a sertain number, but if I type it in my browser I just come to a standard page telling me that the site isn't ready, all by the design of my provider.

Subsequently, using the "GET /color.php" just returns a 404.

There must be some way to find out the right "GET ..."-command, but I don't know how. Anyone with more experience willing to guide or help?

I have asked my provider for help also, but they haven't replied yet.

mvh, Per

If I understand you correctly it sounds like your site is a "virtual" site, which means that when you make the request for the URL you also need to specify a "Host:" header with your site name so the web server knows which site on the server you are referring to.

--Phil.

Another vote for follower's theory, the Host: section is required even if you aren't using a virtual site. But it helps to think that the IP address is the location of the server, and the server knows whose pages to serve based on the URL that was requested.

I'm using a server that lives in a private network and doesn't have a domain name, so I use the IP address in the Host: parameter.

Thank you so much for your help! I've got it to connect and I have it to download my stored color value as a string. Only problem now is to convert the string recived back to hex values to send to the BlinkM, but I'll find out eventually.

For anyone reading this post and with as little knowledge as me, these following lines explains the way to connect to a virtual site.

if (client.connect()) {
    Serial.println("connected");
    client.println("GET /page.php HTTP/1.1");
    client.println("Host: www.example.se");
    client.println();
    client.println();
  }

Prehaps a bit more documentation about this (headers and so forth) is needed as the ethernet shield introduces yet another language to the Arduino community?

-Per

Thanks for taking the time to contribute back the actual code to your solution. It's a valuable contribution to the community.

--Phil.