Grabbing the content from a web page

To illustrate how the WiFi101 library is working on the MKR1000 board, we are now going to use it to grab the content of a web page, and display the result inside the Serial monitor.

Getting ready

You do not need any extra steps here, simply make sure that you have the WiFi101 library installed.

How to do it...

Let's now see the sketch for this recipe. As it is really similar to the sketch of the previous recipe, I will only highlight the main pieces of code that were added here:

  1. You first need to define which page we are going to grab. Here, I will just make the board grab the www.example.com page:
    char server[] = "www.example.com";
  2. Then, we need to create an instance of a Wi-Fi client:
    WiFiClient client;
  3. Then, inside ...

Get Internet of Things with Arduino Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.