前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >微信域名检测PHP源码

微信域名检测PHP源码

原创
作者头像
晶天
修改2021-02-23 18:03:03
6.5K0
修改2021-02-23 18:03:03
举报
文章被收录于专栏:域名技术域名技术
代码语言:php
复制
$url = "http://api.new.urlzt.com/api/vx";
$params = array(
'appkey' =>'appkey',//您申请的APPKEY
'url' =>'www.urlzt.com',//您需要检测的域名
);
 
$paramstring = http_build_query($params);
$content = monkeyCurl($url, $paramstring);
$result = json_decode($content, true);
if($result) {
    var_dump($result);
}else {
    //请求异常
}
 
/**
    * 请求接口返回内容
    * @param    string $url [请求的URL地址]
    * @param    string $params [请求的参数]
    * @param    int $ipost [是否采用POST形式]
    * @return    string
*/
function monkeyCurl($url, $params = false, $ispost = 0)
{
    $httpInfo = array();
    $ch = curl_init();
 
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    if ($ispost) {
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        curl_setopt($ch, CURLOPT_URL, $url);
    }else {
        if ($params) {
            curl_setopt($ch, CURLOPT_URL, $url.'?'.$params);
        } else {
            curl_setopt($ch, CURLOPT_URL, $url);
        }
    }
 
    $response = curl_exec($ch);
        if ($response === FALSE) {
        //echo "cURL Error: " . curl_error($ch);
        return false;
    }
 
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $httpInfo = array_merge($httpInfo, curl_getinfo($ch));
    curl_close($ch);
    return $response;
}

接口对接教程:《2021最新的微信官方域名检测API接口》

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 接口对接教程:《2021最新的微信官方域名检测API接口》
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档