時(shí)間:2023-02-21 05:06:01 | 來源:建站知識(shí)
時(shí)間:2023-02-21 05:06:01 來源:建站知識(shí)
PHP請(qǐng)求微信域名檢測(cè)接口官方API的詳解與示例:微信域名檢測(cè)接口API是騰訊官方對(duì)外公布的域名查詢接口,請(qǐng)求接口可實(shí)時(shí)查詢域名在微信種的狀態(tài)信息。如果狀態(tài)異常則返回結(jié)果提示“域名被封”,如果未有異常則返回結(jié)果提示“域名正?!?。域名正常:{ "code": 200, "msg": "域名正常", "data": 0}非官方網(wǎng)址,請(qǐng)確認(rèn)是否繼續(xù)訪問:{ "code": 200, "msg": "非官方網(wǎng)址,請(qǐng)確認(rèn)是否繼續(xù)訪問", "data": 1}域名已封殺:{ "code": 200, "msg": "域名已封殺", "data": 2}提示如需瀏覽,請(qǐng)長按網(wǎng)址復(fù)制后使用瀏覽器打開:{ "code": 200, "msg": "提示如需瀏覽,請(qǐng)長按網(wǎng)址復(fù)制后使用瀏覽器打開", "data": 3}
$url = "http://api.monkeyapi.com";$params = array('appkey' =>'appkey',//您申請(qǐng)的APPKEY'url' =>'www.monkeyapi.com',//需要查詢的網(wǎng)站);$paramstring = http_build_query($params);$content = Curl($url, $paramstring);$result = json_decode($content, true);if($result) { var_dump($result);}else { //請(qǐng)求異常}/** * 請(qǐng)求接口返回內(nèi)容 * @param string $url [請(qǐng)求的URL地址] * @param string $params [請(qǐng)求的參數(shù)] * @param int $ipost [是否采用POST形式] * @return string*/function Curl($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;}
關(guān)鍵詞:官方,示例,請(qǐng)求
客戶&案例
營銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。