So one last question, is it possible to store a webpage in the arduino and load the webpage simply accessing an URL?? That's what I wanted to do before. It is more simply than sending a request. The webpage would act as a webserver.
The easiest way: put an SD card in your computer. On that SD card, create a folder at the root level named "arduino" and inside of that, create a folder named "www" then put the files you want to serve up in that folder. You can create sub-folders as well. Now put that SD card in your Yun. So, suppose you created a test.html file, on the SD card the path to it would be:
You would access this file with the URL:
Note that the first "folder" in the URL is /sd/ - this tells the web server to look for the resource in the /arduino/www folder of the SD card. Of course, you would substitute your own Arduino's name or IP address for the "arduino.local" part of the URL.
That first "folder" in the URL has special meaning:
- arduino - send the rest of the request to the YunServer/YunClient in the sketch.
- sd - serve the resource in the /arduino/www/ folder of the SD card.
- data/get - read a key value that was set by calling the Bridge.put() on the Yun
- data/put - write a key value that can be read by calling the Bridge.get() on the Yun
- mailbox - write a message to the mailbox queue that can be read by Mailbox.read() on the Yun