Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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;
     }
 }