微信域名檢測 騰訊微信域名檢測的機制原理以及實現方式
阿新 • • 發佈:2019-01-14
array mstr location ati dsp 營銷 lse ram csdn
最近在網上看到很多網友在問微信域名攔截檢測API接口。有的是想找一個穩定靠譜的服務商,有的是剛接觸這方面的業務想通過程序來代替之前的人工檢測,更有甚者想具體了解微信域名檢測API接口的原理,當然這部分人群大多數是技術人員或者是喜歡研究的。不管你是出於什麽目的,作為一個研究接口服務多年的人來說這個接口的原理是非常簡單的,而且產品基本上也很成熟。如果不是想深入接口行業而只是用這個工具,建議直接購買服務即可,著重考慮營銷方面可能更有必要。今天在這裏分享一段代碼供大家參考,如有的方
- $url = "http://api.xxxx.com";
-
$params = array(
- ‘appkey‘ =>‘appkey‘,//您申請的APPKEY
- ‘url‘ =>‘www.monkeyapi.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;
- }
微信域名檢測 騰訊微信域名檢測的機制原理以及實現方式