maxsky / wechat-url-checker
Check url available in WeChat
v1.1
2022-04-25 03:40 UTC
Requires
- php: >=8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.5|^7.0
Requires (Dev)
- phpunit/phpunit: ^7.5|^8.0
This package is auto-updated.
Last update: 2024-11-25 09:24:29 UTC
README
检测 URL 在微信中是否可用
要求
PHP >= 7.1
原理
通过 Get 请求 https://mp.weixinbridge.com/mp/wapredirect?url=TARGET_URL
地址,获取 302 跳转前的响应头 Location
并与 TARGET_URL
对比,一致为可用,不一致为不可用。
安装
composer required maxsky/wechat-url-checker
测试
<?php use MaxSky\WeChat\UrlChecker; $checker = new UrlChecker(); $this->assertTrue($checker->check('https://github.com'));