{"id":1153,"date":"2013-03-29T15:19:33","date_gmt":"2013-03-29T20:19:33","guid":{"rendered":"http:\/\/www.tigoe.com\/pcomp\/code\/?p=1153"},"modified":"2013-03-29T15:21:01","modified_gmt":"2013-03-29T20:21:01","slug":"arduino-ethernet-and-wifi-and-your-favorite-band","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/1153\/","title":{"rendered":"Arduino Ethernet (and WiFi) and Your Favorite Band"},"content":{"rendered":"<p>Let&#8217;s say you&#8217;re a fan of one of the bands in The Deli magazine&#8217;s <a href=\"http:\/\/nyc.thedelimagazine.com\/snacks\">new bands poll<\/a>. There are so many good bands there, like <a href=\"https:\/\/www.facebook.com\/teengirlscientistmonthly\/\">Teen Girl Scientist Monthly<\/a>, and others. And let&#8217;s say you were looking for a project for an Arduino WiFi shield or Ethernet shield. \u00a0Why not make your Arduino vote for your favorite band? It&#8217;s not hard to do.<\/p>\n<p>First you need to know how to scrape the webpage for the URL of the vote. If you view source on the page, you&#8217;ll see it nice and clear:<\/p>\n<pre>\/poll\/poll.php?category=6&amp;answer=6560&amp;adZone=7<\/pre>\n<p>So the whole URL is<\/p>\n<pre>http:\/\/nyc.thedelimagazine.com\/poll\/poll.php?category=6&amp;answer=6560&amp;adZone=7<\/pre>\n<p>Great! Now, take the WiFi WebClient example, or the Ethernet WebClient example, and change a few lines:<\/p>\n<p>Change \u00a0this:<\/p>\n<pre>client.println(\"GET \/search?q=arduino HTTP\/1.1\");\r\nclient.println(\"Host:www.google.com\");<\/pre>\n<p>to this:<\/p>\n<pre>client.println(\"GET \/poll\/poll.php?category=6&amp;answer=6560&amp;adZone= HTTP\/1.1\");\r\n client.println(\"Host:nyc.thedelimagazine.com\");<\/pre>\n<p>And change this:<\/p>\n<pre>char server[] = \"nyc.thedelimagazine.com\";<\/pre>\n<p>to this:<\/p>\n<pre>char server[] = \"www.google.com\";<\/pre>\n<p>And give it a go! Remember, no cheating. You can only vote once per IP address. \u00a0But if you know a friend with several WiFi shields or Ethernet shields, well, that&#8217;s only one IP address per shield, right?<\/p>\n<p>&nbsp;<\/p>\n<p>(Good luck, Matt and the band!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s say you&#8217;re a fan of one of the bands in The Deli magazine&#8217;s new bands poll. There are so many good bands there, like Teen Girl Scientist Monthly, and others. And let&#8217;s say you were looking for a project for an Arduino WiFi shield or Ethernet shield. \u00a0Why not make your Arduino vote for &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/1153\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Arduino Ethernet (and WiFi) and Your Favorite Band&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1153","post","type-post","status-publish","format-standard","hentry","category-arduinowiring"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/1153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/comments?post=1153"}],"version-history":[{"count":2,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/1153\/revisions"}],"predecessor-version":[{"id":1155,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/1153\/revisions\/1155"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=1153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=1153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=1153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}