Let’s say you’re a fan of one of the bands in The Deli magazine’s new bands poll. There are so many good bands there, like Teen Girl Scientist Monthly, and others. And let’s say you were looking for a project for an Arduino WiFi shield or Ethernet shield. Why not make your Arduino vote for your favorite band? It’s not hard to do.
First you need to know how to scrape the webpage for the URL of the vote. If you view source on the page, you’ll see it nice and clear:
/poll/poll.php?category=6&answer=6560&adZone=7
So the whole URL is
http://nyc.thedelimagazine.com/poll/poll.php?category=6&answer=6560&adZone=7
Great! Now, take the WiFi WebClient example, or the Ethernet WebClient example, and change a few lines:
Change this:
client.println("GET /search?q=arduino HTTP/1.1"); client.println("Host:www.google.com");
to this:
client.println("GET /poll/poll.php?category=6&answer=6560&adZone= HTTP/1.1"); client.println("Host:nyc.thedelimagazine.com");
And change this:
char server[] = "nyc.thedelimagazine.com";
to this:
char server[] = "www.google.com";
And give it a go! Remember, no cheating. You can only vote once per IP address. But if you know a friend with several WiFi shields or Ethernet shields, well, that’s only one IP address per shield, right?
(Good luck, Matt and the band!)