Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Internet of Things Projects with ESP32

You're reading from   Internet of Things Projects with ESP32 Build exciting and powerful IoT projects using the all-new Espressif ESP32

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789956870
Length 252 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Agus Kurniawan Agus Kurniawan
Author Profile Icon Agus Kurniawan
Agus Kurniawan
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with ESP32 2. Making Visual Data and Animation on an LCD FREE CHAPTER 3. Building a Simple Game with an Embedded ESP32 Board 4. Building a Sensor Monitoring Logger 5. Controlling IoT Devices over the Internet 6. Building an IoT Weather Station 7. Making Your Own Wi-Fi Wardriving 8. Building Your Own Wi-Fi Cam 9. Making IoT Devices Interact with Mobile Applications 10. Building IoT Monitoring with Cloud Technology 11. Other Books You May Enjoy

Accessing data from a web server

In the previous section, we learned how to connect an existing Wi-Fi hotspot with an ESP32 board. Now, we will try to access a web server from our ESP32 board. Technically, ESP32 APIs adopt the socket programming model to communicate with other systems over a network.

For demo purposes, we will access a web server. We will use Google as a web server target here. We can start by creating the ESP32 project called http_request, with the http_request.c file as the main program. This project can also be found on the official website of the Espressif IDF project, at https://github.com/espressif/esp-idf/tree/master/examples/protocols/http_server.

  1. First, we will load the libraries in our project, including the network libraries such as socket.h and dns.h:
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image