




免費預覽已結束,剩余1頁可下載查看
下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
基于php的網(wǎng)站監(jiān)測接口調用代碼實例代碼描述:基于php的網(wǎng)站監(jiān)測接口調用代碼實例代碼平臺:聚合數(shù)據(jù)!-?php/ +-/ | JuhePHP NO ZUO NO DIE / +-/ | Copyright (c) 2010-2015 All rights reserved./ +-/ | Author: Juhedata / +-/-/ 網(wǎng)站監(jiān)測調用示例代碼 聚合數(shù)據(jù)/ 在線接口文檔:/docs/140/-header(Content-type:text/html;charset=utf-8);/配置您申請的appkey$appkey = *;/*1.創(chuàng)建任務*$url = /webxmf/createTask;$params = array(key = $appkey,/您申請到的APPKEYurl = ,/要監(jiān)測的網(wǎng)站的根域名,注意:必須是根域名,其他不支持dtype = ,/返回的數(shù)據(jù)格式,json或xml,默認jsoncontactPhone = ,/);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/*2.獲取監(jiān)測任務列表*$url = /webxmf/getTaskList;$params = array(key = $appkey,/您申請到的APPKEYdtype = ,/返回的數(shù)據(jù)格式,json或xml,默認jsonpage = ,/頁碼pageSize = ,/每頁的個數(shù));$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/*3.獲取監(jiān)測網(wǎng)站實時數(shù)據(jù)*$url = /webxmf/getRealTimeData;$params = array(key = $appkey,/您申請到的APPKEYdtype = ,/返回的數(shù)據(jù)格式,json或xml,默認jsonsiteId = ,/網(wǎng)站的id,請在任務列表API里查詢industry = ,/行業(yè)id,請在任務列表API里查詢);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/*4.獲取監(jiān)測網(wǎng)站實時ping響應*$url = /webxmf/getPingData;$params = array(key = $appkey,/您申請到的APPKEYsiteId = ,/網(wǎng)站URL唯一標識,請在任務列表API里查詢industry = ,/行業(yè)代碼,請在任務列表API里查詢);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/*5.獲取監(jiān)測網(wǎng)站實時http響應*$url = /webxmf/getHttpData;$params = array(key = $appkey,/您申請到的APPKEYsiteId = ,/網(wǎng)站URL唯一標識,請在任務列表API里查詢industry = ,/行業(yè)代碼,請在任務列表API里查詢);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/*6.獲取監(jiān)測網(wǎng)站實時運營商數(shù)據(jù)*$url = /webxmf/getIspRealtime;$params = array(key = $appkey,/您申請到的APPKEYsiteId = ,/網(wǎng)站URL唯一標識,請在任務列表API里查詢);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 請求失敗;/*/* 請求接口返回內容* param string $url 請求的URL地址* param string $params 請求的參數(shù)* param int $ipost 是否采用POST形式* return string*/function juhecurl($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_USERAGENT , JuheData );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 );elseif($params)curl_setopt( $ch , CURLOPT_URL , $url.?.$params );elsecurl_setopt( $ch , CURLOPT_URL , $url);$response = curl_exec( $ch );if ($response = FALSE) /echo cURL E
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 學校日常微管理制度
- 學校運動區(qū)管理制度
- 學生接送車管理制度
- 孵化廠銷售管理制度
- 安全及消防管理制度
- 安全運行與管理制度
- 實名制入井管理制度
- 實驗室培訓管理制度
- 客戶為中心管理制度
- 宣講員聘用管理制度
- 期末綜合試題 2024-2025學年下期初中英語人教版七年級下冊(新教材)
- 2025年甘肅高考真題化學試題(解析版)
- 惡臭的測定作業(yè)指導書
- 中國政法大學《中國政治制度史》2023-2024學年第二學期期末試卷
- 2024年上海浦東新區(qū)公辦學校儲備教師教輔招聘真題
- 2025年高考歷史全國卷試題評析-教育部教育考試院
- 貴州省貴陽市2023?2024學年度第二學期期末監(jiān)測試卷高一 數(shù)學試題(含解析)
- 公共組織績效評估-形考任務三(占10%)-國開(ZJ)-參考資料
- 康復醫(yī)學科治療技術操作規(guī)范2023版
- 2025年貴安發(fā)展集團有限公司招聘筆試參考題庫含答案解析
- 趣識古文字智慧樹知到期末考試答案章節(jié)答案2024年吉林師范大學
評論
0/150
提交評論