PHP WeChat development to obtain city weather
This article mainly introduces in detail the simple implementation of PHP WeChat development to query city weather related information. Interested friends can refer to it. I hope to be helpful.
PHP WeChat queries city weather. First, you need to find an API to get the weather. Here, I use Baidu’s apistore. The URL for applying and using the API: http://apistore.baidu.com /apiworks/servicedetail/112.html
Log in to your Baidu account and use your mobile phone to send a request to obtain the apikey. With apikey, you can follow its example to request city weather. (You can search according to the Chinese name of the city, pinyin, city number, etc.)
You can do the test locally now, and after the request is completed, put it in the script of your own domain name space inside.
Test script example: (note that the apikey is filled in by yourself)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
If you fill in your own apikey, you should be able to get the requested weather:
If normal data can be returned, then it can be placed in your domain name space. (The url filled in by the developer center in the public platform, which has functions such as connecting to the WeChat interface)
The following code is part of responseMsg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
After completion (don’t forget to fill in the apikey) , enter the weather Shanghai in your subscription account, and you should be able to check the weather in Shanghai that day.
Related recommendations:
Summary of common error messages in WeChat public account development and configuration
WeChat public account implements user management function
TP access to WeChat public account payment details
The above is the detailed content of PHP WeChat development to obtain city weather. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.
