You never see it, but a web server actually sends extra information know as a "header" that tells the browser various information about that page (this is different than HTML'sīecause of this, we need a way to tell the arduino what is junk, and what is the good stuff. Even if the page we are reading contains only the information we need, there is extra information at the beginning that is sent to the arduino. ![]() So it can be like a needle in a haystack on large pages. But the reading is done one byte at a time, and it reads the entire thing. In the client mode, the ethernet shield is able to access a webpage and return what is read. But, the idea is that you could easily take that PHP file (any web accessible file) and taylor it to display whatever you need. I did this because getting everyone setup with an API account somewhere is beyond the scope of this article, and unneeded to prove the concept and get you started. ![]() I created a PHP file that just outputs a random alphanumeric string. This made it so I didn't have to tell the arduino what to look for, or scour endless lines of HTML looking for a single number. For Twixie I created a special php page that queried the twitter API and displayed only the twitter count. The ethernet shield can be used to access any non-password protected site with ease, but getting the information back to you is the hard part. I used this method a few months ago when I made the Nixie Twitter follower counter dubbed Twixie. Today we are going to take a look at using the shield as a client to get information off of a web page, and report back. Yesterday we covered how you would go about controlling pins of your arduino over the internet using the Arduino Ethernet Shield set up as a server.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |