esp-idf/examples/protocols/https_request のプログラムを改造します。
M5Stack Core2 で動作確認をしました。
次のサイトにアクセスする例です。
プログラム
プロジェクトのコピー
cd ~/esp
cp -r esp-idf/examples/protocols/https_request .
http_request/sdkconfig を作成
idf.py build
変更する場所
https_request/sdkconfig
(省略)
CONFIG_EXAMPLE_WIFI_SSID="****"
CONFIG_EXAMPLE_WIFI_PASSWORD="****"
(省略)
https_request/main/https_request_example_main.c
(省略)
#define WEB_SERVER "ekzemplaro.org"
#define WEB_PORT "443"
#define WEB_URL "https://ekzemplaro.org/test_dir/"
(省略)
コンパイル、実行
idf.py -p /dev/ttyUSB0 flash
実行結果
HTTP/1.1 200 OK
Server: nginx/1.22.1
Date: Mon, 30 Jan 2023 08:09:22 GMT
Content-Type: text/html
Content-Length: 993
Last-Modified: Fri, 30 Sep 2022 01:56:22 GMT
Connection: keep-alive
ETag: "63364cc6-3e1"
Accept-Ranges: bytes
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@ekzemplaro" />
<meta property="og:url" content="https://ekzemplaro.org/test_dir/" />
<meta property="og:title" content="テス�
��のページ" />
<meta property="og:description" content="サーバーのテスト" />
<meta property="og:image" content="https://ekzemplaro.org/png/linux_logo.png" />
<title>テストコーナー</title>
</head>
<body>
<h2>テストのページ</h2>
<blockquote>
AAA<br />
BBB<br />
CCC<p />
</blockquote>
<a href="test_a001.php">test_a001.php</a><p />
<a href="test_a002.php">test_a002.php</a><p />
<a href="test_a003.php">test_a003.php</a><p />
<a href="test_a004.php">test_a004.php</a><p />
<p />
<a href=
"php/">PHP のテスト</a><p />
<a href="python/">python のテスト</a><p />
<a href="ruby/">Ruby のテスト</a><p />
<a href="perl/">perl のテスト</a><p />
Sep/30/2022 AM 09:42<br />
</body>
</html>