天心api:微信/QQ 防红 接口
area style="">## 前言
大家好,本人PHP小白,热爱写api 接口
如有bug或者更好的建议可以留言给我
## 一、声明
![天心api:微信/QQ 防红 接口 天心api:微信/QQ 防红 接口](http://sicmodule.kub2b.com/file/upload/image/417.jpg)
### 技术 天心
### 技术 武渟
## 二、api是什么?
API就是操作系统留给应用程序的一个调用接口,应用程序通过调用操作系统的 API 而使操作系统去执行应用程序的命令。
## 三、发送请求
#### 请求方式 http://s520z.cn/api/fh.php
#### 请求方式 GET
#### 请求参数
### url 这里输入域名
### type 参数json 不传则输出五条链接
#### 返回格式 JSON
#### 返回示例
{
"dwz_url": "http://wifiauth.polito.it/2pJKfM",
"msg": "ok",
"result": 1
}
## 四、实列代码
```php
<?php
//$str='d3d3LmpiNTEubmV0IOiEmuacrOS5i+Wutg=='; //定义字符串
//echo base64_decode($str); //输出解码后的内容
$url = $_GET["url"];
$type = $_GET["type"];
$ba=base64_encode($url); // 输出编码后的内容
$fh1=file_get_contents("https://www.fanghong.net/cbfh.php?cb=1&sturl=99&longurl=$ba");
$fh2=file_get_contents("https://www.fanghong.net/cbfh.php?cb=1&sturl=6&longurl=$ba");
$fh3=file_get_contents("https://www.fanghong.net/cbfh.php?cb=1&sturl=1&longurl=$ba");
$fh4=file_get_contents("http://wuting.xyz/api/fh.php?lj=$url&type=json");
if ($type == "json") {
echo $fh1;
return;
}
$json_string=$fh1;
$obj1=json_decode($json_string);
$nm1 = $obj1->dwz_url;
$json_string=$fh2;
$obj2=json_decode($json_string);
$nm2 = $obj2->dwz_url;
$json_string=$fh3;
$obj3=json_decode($json_string);
$nm3 = $obj3->dwz_url;
$json_string=$fh4;
$obj4=json_decode($json_string);
$nm4 = $obj4->url_1;
$json_string=$fh4;
$obj5=json_decode($json_string);
$nm5 = $obj5->url_2;
$json_string=$fh1;
$obj1=json_decode($json_string);
$bl = $obj1->result;
if ($nm1 == "0") {
echo"请检查域名后重试。";
}else if ($bl == "1") {
echo "原链接".$url."
";
echo "1.".$nm1."
";
echo "2.".$nm2."
";
echo "3.".$nm3."
";
echo "4.".$nm4."
";
echo "5.".$nm5."
";
}
?>
```
## 五、总结
有的域名红了就很烦,不用担心,本代码解决你的烦恼。
QQ或者微信打开跳转浏览器
特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。