<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                * [GET請求某個URL(簡單)](http://www.hmoore.net/donknap/we7/212602#GETURL_5) * [POST請求某個URL(簡單)](http://www.hmoore.net/donknap/we7/212602#POSTURL_59) * [請求某個URL(高級)](http://www.hmoore.net/donknap/we7/212602#URL_83) * [附加表單數據請求到某個URL](http://www.hmoore.net/donknap/we7/212602#URL_98) * [請求時附加一些頭部信息](http://www.hmoore.net/donknap/we7/212602#_113) > 使用前請務必 load()->func('communication'); #### GET請求某個URL(簡單) > ihttp\_get($url) * $url 要獲取內容的URL,必須是以http或是https開頭 *返回值*` error [錯誤結構](http://www.hmoore.net/donknap/we7/134630) success ~~~ array ( 'code' => 200 //http 狀態碼 'status' => OK //http 狀態信息 'responseline' => HTTP/1.1 200 OK 'headers' => array ( //返回頭部的一些信息,這里是直接顯示百度的返回頭部信息 //具體功能函數不在這里贅述,可以查看HTTP相關文檔 'Server' => bfe/1.0.8.18 'Date' => Wed, 21 Sep 2016 03:23:54 GMT 'Content-Type' => text/html; charset=utf-8 'Connection' => close 'Vary' => Accept-Encoding 'P3P' => CP=" OTI DSP COR IVA OUR IND COM " 'Cache-Control' => private 'Cxy_all' => baidu+7cf6bc2c9c5ae104a1dad56cb1e2a027 'Expires' => Wed, 21 Sep 2016 03:22:58 GMT 'X-Powered-By' => HPHP 'X-UA-Compatible' => IE=Edge,chrome=1 'Strict-Transport-Security' => max-age=604800 'BDPAGETYPE' => 1 'BDQID' => 0x9f936d6300036048 'BDUSERID' => 0 // 此處返回服務器給客戶端設置的Cookie信息 // 下面的例子中會有怎么使用的例子 'Set-Cookie' => array ( '0' => H_PS_PSSID=1437_21014_17944_21127_; path=/; domain=.baidu.com '1' => __bsi=1222377018390; expires=Wed, 21-Sep-16 03:23:59 GMT; domain=www.baidu.com; path=/ ) ) 'content' => '<!DOCTYPE html><!--STATUS OK--><html><head>..省略3千字...</body></html>' //網頁的HTML內容 ) ~~~ *示例* ~~~ load()->func('communication'); $response = ihttp_get('http://baidu.com'); print_r($response['content']); ~~~ #### POST請求某個URL(簡單) > ihttp\_post($url, $data) * $url 要獲取內容的URL,必須是以http或是https開頭 * $data 要提交的表單數據,數組格式,如果是上傳文件,則以 @ + 文件物理路徑 書寫 *返回值*` 與 ihttp\_get 函數相同 *示例* ~~~ //微擎會自動處理兼容為new CURLFile的寫法 $fullname = ATTACHMENT_ROOT . '/images/691/2016/08/tWSNp69sp82ErcW8c0NYSm86s86Cl0.jpg'; $sendapi = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token={$token}"; $data = array( 'name' => 'mizhou', 'media' => '@'.$fullname ); load()->func('communication'); $response = ihttp_post($sendapi, $data); ~~~ #### 請求某個URL(高級) > ihttp\_request($url, $post = '', $extra = array(), $timeout = 60) * $url 要獲取內容的URL,必須是以http或是https開頭 * $post 數組格式,要POST請求的數據,為空時則會以GET形式請求 * $extra 請求附加值,下面會例子中會演示使用方法 * $timeout 超時時間 *返回值*` 與 ihttp\_get 函數相同 *示例* ###### 附加表單數據請求到某個URL ~~~ load()->func('communication'); $loginurl = 'https://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN'; $post = array( 'username' => $username, 'pwd' => $password, ); $response = ihttp_request($loginurl, $post); if (is_error($response)) { return false; } return true; ~~~ ###### 請求時附加一些頭部信息 ~~~ //此實例為獲取微信圖片 //微信的圖片需要要求必須有引用頁,程序中無法直接調用,以下代碼實現一個具體引用頁的請求來獲取微信圖片 load()->func('communication'); //微信圖片 $image = trim($_GPC['attach']); if(empty($image)) { exit(); } $content = ihttp_request($image, '', array('CURLOPT_REFERER' => 'http://www.qq.com')); header('Content-Type:image/jpg'); echo $content['content']; exit(); ~~~ ~~~ //此實例為獲取支付寶的支付地址 //支付寶的接口通過301跳轉來發送給客戶端跳轉地址,程序中為了獲取此url,故設置請求時不自動跳轉 load()->func('communication'); $response = ihttp_request(ALIPAY_GATEWAY . '?' . http_build_query($set, '', '&'), array(), array('CURLOPT_FOLLOWLOCATION' => 0)); return array('url' => $response['headers']['Location']); ~~~ ~~~ //此實例為模擬微信請求地址,請求數據為xml格式 load()->func('communication'); $response = ihttp_request($item['apiurl'], $message, array('CURLOPT_HTTPHEADER' => array('Content-Type: text/xml; charset=utf-8'))); return $response['content']; ~~~ ~~~ //此實例為附件cookie請求 //有些地址可能以cookie來判斷是否是惡意程序請求 load()->func('communication'); $response = ihttp_get($url); $cookiejar = $response['headers']['Set-Cookie']; $response = ihttp_request($urlpost, array('num' => 1), array( 'CURLOPT_COOKIE' => implode('; ', $cookiejar), 'CURLOPT_REFERER' => 'https://selfsolve.apple.com/agreementWarrantyDynamic.do', )); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看