<span id="pfnzv"></span>
      <form id="pfnzv"><span id="pfnzv"></span></form><address id="pfnzv"><span id="pfnzv"><nobr id="pfnzv"></nobr></span></address>
      <form id="pfnzv"><dfn id="pfnzv"><listing id="pfnzv"></listing></dfn></form>

        <sub id="pfnzv"><address id="pfnzv"></address></sub>
          <address id="pfnzv"><form id="pfnzv"><listing id="pfnzv"></listing></form></address>
          <address id="pfnzv"><address id="pfnzv"><nobr id="pfnzv"></nobr></address></address>

            <address id="pfnzv"></address>
            0712-2888027 189-8648-0214
            微信公眾號

            孝感風信網絡科技有限公司微信公眾號

            當前位置:主頁 > 技術支持 > PHP > Laravel模擬PHP GET/POST請求示例代碼

            Laravel模擬PHP GET/POST請求示例代碼

            時間:2024-08-24來源:風信官網 點擊: 3634次
            Laravel模擬PHP GET/POST請求示例代碼
             
            模擬GET請求百度天氣信息API
             
            <?php 
             
            //創建連接
            $fp = fsockopen('apis.baidu.com',80, $errno, $errstr, 10);
             
            if(!$fp) {
            echo $errstr;die;
            }
             
            //
            $http = '';
             
            //請求行
            $http .= "GET /apistore/weatherservice/citylist?cityname=北京 HTTP/1.1\r\n";
             
            //請求頭
            $http .= "Host: apis.baidu.com\r\n";
            $http .= "Connection: close\r\n";
            $http .= "apikey: 1ae6f08bddd8e5cb8c34e9941cfaa93c\r\n\r\n";
             
            //發送
            fwrite($fp, $http);
             
            //獲取結果
            $res = '';
             
            while(!feof($fp)) {
            $res .= fgets($fp);
            }
             
            echo $res;
             
             
             ?>
             
             模擬POST請求數據信息
             
             <?php 
             
            //創建連接
            $fp = fsockopen('localhost', 80, $errno, $errstr, 10);
             
            //判斷
            if(!$fp) {
            echo $errstr;die;
            }
             
            $http = '';
             
            //請求行
            $http .= "POST /class/Public/laravel/http/server.php HTTP/1.1\r\n";
             
            //請求頭
            $http .= "Host: localhost\r\n";
            $http .= "Connection: close\r\n";
            $http .= "Cookie: username=admin;uid=200\r\n";
            $http .= "User-agent: firefox-chrome-safari-ios-android\r\n";
            $http .= "Content-type: application/x-www-form-urlencoded\r\n";
            $http .= "Content-length: 37\r\n\r\n";
             
            //請求體
            $http .= "email=123456@qq.com&username=admin\r\n";
             
            //發送
            fwrite($fp, $http);
             
            $res = '';
            //獲取結果
            while(!feof($fp)) {
            $res .= fgets($fp);
            }
             
            echo $res;
             
            ?>
            熱門關鍵詞: Laravel 模擬PHP GET POST PHP請求
            欄目列表
            推薦內容
            熱點內容
            展開
            国产精久久久久无码AV动漫|最新亚洲精品国偷自产在线|2021亚洲色中文字幕在线|最新无码av中文字专区 情欲美妇紧致敏感 国产免费AⅤ片在线播放 人妻爽爽免费在线视频 51精品国产人成在线观看 色偷偷av一区二区三区
            <span id="pfnzv"></span>
                <form id="pfnzv"><span id="pfnzv"></span></form><address id="pfnzv"><span id="pfnzv"><nobr id="pfnzv"></nobr></span></address>
                <form id="pfnzv"><dfn id="pfnzv"><listing id="pfnzv"></listing></dfn></form>

                  <sub id="pfnzv"><address id="pfnzv"></address></sub>
                    <address id="pfnzv"><form id="pfnzv"><listing id="pfnzv"></listing></form></address>
                    <address id="pfnzv"><address id="pfnzv"><nobr id="pfnzv"></nobr></address></address>

                      <address id="pfnzv"></address>