「Webサイトに天気を表示させたい」
「OpenWeatherMapの使い方がわからない」
こういった悩みにお答えします。
- PHPで天気を表示させられるようになります。
- WordPressでも使用できます。
- 応用次第ではアプリ等にも転用できます。
この記事ではこんなことがわかります。
- 目次
OpenWeatherMap とは
OpenWeatherMapは、現在の天気や天気予報などの無料APIを提供するオンラインサービスです。
Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /home/hashi84/hsmt-web.com/public_html/wp/wp-content/themes/hsmt-web/functions/custom_ogp.php:29 Stack trace: #0 /home/hashi84/hsmt-web.com/public_html/wp/wp-content/themes/hsmt-web/functions/custom_ogp.php(29): DOMDocument->loadHTML('') #1 /home/hashi84/hsmt-web.com/public_html/wp/wp-content/themes/hsmt-web/blog/openweathermap-api.php(34): get_ogp('https://openwea...') #2 /home/hashi84/hsmt-web.com/public_html/wp/wp-includes/template.php(812): require('/home/hashi84/h...') #3 /home/hashi84/hsmt-web.com/public_html/wp/wp-includes/template.php(745): load_template('/home/hashi84/h...', false, Array) #4 /home/hashi84/hsmt-web.com/public_html/wp/wp-includes/general-template.php(206): locate_template(Array, true, false, Array) #5 /home/hashi84/hsmt-web.com/public_html/wp/wp-content/themes/hsmt-web/single-blog.php(100): get_template_part('blog/openweathe...') #6 /home/hashi84/hsmt-web.com/public_html/wp/wp-includes/template-loader.php(106): include('/home/hashi84/h...') #7 /home/hashi84/hsmt-web.com/public_html/wp/wp-blog-header.php(19): require_once('/home/hashi84/h...') #8 /home/hashi84/hsmt-web.com/public_html/index.php(17): require('/home/hashi84/h...') #9 {main} thrown in /home/hashi84/hsmt-web.com/public_html/wp/wp-content/themes/hsmt-web/functions/custom_ogp.php on line 29