


Business scenario: During the development process of WeChat public accounts, there are often some long links. If a QR code is generated at this time, the recognition will be slow during the scanning process. If it is stored in the database, it will cause the database to be corrupted. The field length needs to be set very long, so it is increasingly important to convert long links into short links.
Interface description document address:
mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433600&token=&lang=zh_CN
Interface calling URL: https: //api.weixin.qq.com/cgi-bin/shorturl?access_token=ACCESS_TOKEN
Interface request method: post
Interface parameter data: json
Interface transmission Reference example:
{"action":"long2short","long_url":"https:\/\/ss2.bdstatic.com\/kfoZeXSm1A5BphGlnYG\/icon\/7282.png"}
Interface return data:
{"errcode":0,"errmsg":"ok","short_url":"http:\/\/w.url.cn\/s\/An3qXvS"}
converted to json:
{ "errcode":0, "errmsg":"ok", "short_url":"http://w.url.cn/s/An3qXvS" }
The specific implementation code is as follows:
The effect is as shown:
Okay, this time we will explain how to convert a long URL into a short URL through the WeChat interface
The above is the detailed content of WeChat public account development: Convert long connections into short links through accesstoken. For more information, please follow other related articles on the PHP Chinese website!

Scrapy实现微信公众号文章爬取和分析微信是近年来备受欢迎的社交媒体应用,在其中运营的公众号也扮演着非常重要的角色。众所周知,微信公众号是一个信息和知识的海洋,因为其中每个公众号都可以发布文章、图文消息等信息。这些信息可以被广泛地应用在很多领域中,比如媒体报道、学术研究等。那么,本篇文章将介绍如何使用Scrapy框架来实现微信公众号文章的爬取和分析。Scr

微信公众号认证和不认证的区别在认证标识、功能权限、推送频率、接口权限和用户信任度等方面。详细介绍:1、认证标识,认证公众号会获得官方颁发的认证标识,即蓝色V标志,这个标志可以增加公众号的可信度和权威性,让用户更容易辨别真实的官方公众号;2、功能权限,认证公众号相比未认证的公众号拥有更多的功能和权限,例如认证公众号可以申请开通微信支付功能,实现在线支付和商业化运营等等。

Python是一种优雅的编程语言,拥有强大的数据处理和网络爬虫功能。在这个数字化时代,互联网上充满了大量的数据,爬虫已成为获取数据的重要手段,因此,Python爬虫在数据分析和挖掘方面有着广泛的应用。在本文中,我们将介绍如何使用Python爬虫来获取微信公众号文章信息。微信公众号是一种流行的社交媒体平台,用于在线发布文章,是许多公司和自媒体推广和营销的重要工

Swoole和Workerman对PHP与MySQL的长连接和持久连接的优化方法,需要具体代码示例随着Web应用程序的发展和用户规模的增加,数据库查询成为了应用性能优化的重点之一。而在PHP开发中,常用的数据库连接方式有长连接和短连接。长连接是指在建立数据库连接后保持连接状态,多次重复使用同一个连接;而短连接则是每次查询完毕后关闭连接。在PHP中,传统的My

公众号每天不是只能发一篇文章,每次最多可以发表八篇文章,多篇文章的发布方法:1、点击左侧的“素材管理”,再点击“新建图文素材”开始编辑第一篇文章;2、编辑完第一篇文章之后,点击左侧第一篇文章下面的+号,点击“图文消息”即可编辑第二篇文章;3、做完多图文后,点击“保管并群发”即可完成多篇文章的发布。

在当今互联网时代,微信公众号成为了越来越多企业的重要营销渠道。想要自己的微信公众号实现更多的功能,常常需要编写相应的接口。本文将以PHP语言为例,介绍如何构建一个微信公众号API接口。一、前置准备在编写微信公众号API接口之前,需要开发者拥有一个微信公众号的账号,并且在微信公众平台中申请开发者接口权限。申请成功后,可以获取到相关的开发者AppID和AppSe

随着微信公众号在社交网络中的逐渐普及,越来越多的开发者开始涉足微信公众号开发领域。在这其中,PHP作为一种常见的后端编程语言,也开始被广泛应用于微信公众号的开发中。本文将介绍PHP在微信公众号开发中的基础知识和常用技巧。一、PHP与微信公众号开发基础微信公众号开发微信公众号是指一种基于微信平台的互联网应用程序,可以为用户提供不同类型的服务和内容,如信息推送

随着互联网的普及和移动设备的广泛使用,微信公众号已经成为了企业营销必不可少的一部分。通过微信公众号,企业可以实现轻松地与用户互动,推广产品和服务,提高品牌知名度。为了更好地开发微信公众号应用,越来越多的开发者和企业选择使用Go语言来构建微信公众号应用。Go语言是一种由Google开发的编程语言,它的语法简洁,适合构建高性能、高并发的实时应用程序。在简单易用和


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
