當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Http::http_request方法代碼示例

本文整理匯總了PHP中Http::http_request方法的典型用法代碼示例。如果您正苦於以下問題:PHP Http::http_request方法的具體用法?PHP Http::http_request怎麽用?PHP Http::http_request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Http的用法示例。


在下文中一共展示了Http::http_request方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateMail

 public function updateMail()
 {
     $id = $this->rcpt;
     $http = new Http();
     $url = "http://services.ukrposhta.com/barcodesingle/default.aspx?ctl00%24centerContent%24scriptManager=ctl00%24centerContent%24scriptManager%7Cctl00%24centerContent%24btnFindBarcodeInfo&__EVENTTARGET=&__EVENTARGUMENT=&ctl00%24centerContent%24txtBarcode={$id}&__ASYNCPOST=true&ctl00%24centerContent%24btnFindBarcodeInfo=%D0%9F%D0%BE%D1%88%D1%83%D0%BA";
     $data = $http->http_request(array('url' => $url, 'cookie' => true, 'redirect' => true));
     $page = split("\n", $data);
     $print = 0;
     foreach ($page as $line) {
         if ($print) {
             $result = strip_tags($line) . "\n";
             $print = 0;
         }
         if (strstr("{$line}", "divInfo")) {
             if (strstr("{$line}", "</div>")) {
                 $result = strip_tags($line) . "\n";
             } else {
                 $print = 1;
             }
         }
     }
     if (strstr($result, "вручене за довіреністю")) {
         $this->ddate = date("Y-m-d", strtotime(mb_substr(strstr($result, "вручене за довіреністю "), 23, 10, 'UTF-8')));
         $this->status = 1;
         $this->update();
     } elseif (strstr($result, "вручене адресату (одержувачу) особисто")) {
         $this->ddate = date("Y-m-d", strtotime(mb_substr(strstr($result, "особисто "), 9, 10, 'UTF-8')));
         $this->status = 1;
         $this->update();
     } else {
         return 0;
     }
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:33,代碼來源:HoleRequestSent.php

示例2: actionGetAddress

 public function actionGetAddress()
 {
     header('Access-Control-Allow-Origin: *');
     $lat = $_POST['lat'];
     $lng = $_POST['lng'];
     $uri = "http://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$lng}&language=uk&sensor=false";
     $r = new Http();
     echo $r->http_request($uri);
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:9,代碼來源:EventController.php

示例3: trackMail

 public function trackMail($id)
 {
     $http = new Http();
     $url = "http://services.ukrposhta.com/barcodesingle/default.aspx?ctl00%24centerContent%24scriptManager=ctl00%24centerContent%24scriptManager%7Cctl00%24centerContent%24btnFindBarcodeInfo&__EVENTTARGET=&__EVENTARGUMENT=&ctl00%24centerContent%24txtBarcode={$id}&__ASYNCPOST=true&ctl00%24centerContent%24btnFindBarcodeInfo=%D0%9F%D0%BE%D1%88%D1%83%D0%BA";
     $a = $http->http_request(array('url' => $url, 'return' => 'array', 'cookie' => true));
     $cookie = $a['headers']['SET-COOKIE'];
     $url = "http://services.ukrposhta.com/barcodesingle/DownloadInfo.aspx";
     $data = $http->http_request(array('url' => $url, 'cookie' => $cookie));
     $page = preg_split("\n", $data);
     $print = 0;
     foreach ($page as $line) {
         if ($print) {
             $result = strip_tags($line) . "\n";
             $print = 0;
         }
         if (strstr("{$line}", "divInfo")) {
             if (strstr("{$line}", "</div>")) {
                 $result = strip_tags($line) . "\n";
             } else {
                 $print = 1;
             }
         }
     }
     if (strstr($result, "вручене за довіреністю")) {
         return date("Y-m-d", strtotime(mb_substr(strstr($result, "вручене за довіреністю "), 23, 10, 'UTF-8')));
     } else {
         return 0;
     }
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:29,代碼來源:HolesController.php


注:本文中的Http::http_request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。