How to query Xinhua Dictionary in PHP

藏色散人
Release: 2023-03-17 08:10:01
Original
1150 people have browsed it

How to query Xinhua Dictionary in php: 1. Create a PHP sample file; 2. Set "header('Content-type:text/html;charset=utf-8');"; 3. Configuration application appkey; 4. Query the dictionary through "$params= array("word"=> "","key"=> $appkey,"dtype"=> "",);".

How to query Xinhua Dictionary in PHP

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

How to query Xinhua Dictionary in php?

Xinhua Dictionary interface calling code example based on PHP

Interface address: https://www.juhe.cn/docs/api/id/156?s= cpphpcn

Interface description: Query related information based on Chinese characters, such as pinyin, pronunciation, detailed explanation, Wubi, etc. More than 20,000 Chinese characters, including pronunciation, radicals, structure, stroke order, Wubi, English, explanation, content, polyphonic characters, etc.

Code example:

// +----------------------------------------------------------------------
//----------------------------------
// 新华字典调用示例代码
//----------------------------------
header('Content-type:text/html;charset=utf-8');
//配置您申请的appkey
$appkey= "*********************";
//************1.根据汉字查询字典************
$url= "http://www.doczj.com/doc/b4219482783e0912a2162aeb.html/xhzd/query";
$params= array(
"word"=> "",//填写需要查询的汉字,UTF8 urlencode编码
"key"=> $appkey,//应用APPKEY(应用详细页查询)
"dtype"=> "",//返回数据的格式,xml或json,默认json
);
Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to query Xinhua Dictionary in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template