Example #1
0
 public function fetchAwardNumberInfo($expect)
 {
     //实际开奖时间延迟60秒左右
     sleep(60);
     $fetchExpect = substr($expect, 2);
     //每5秒从caipiao.163.com尝试获取开奖数据,共尝试20次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163(self::_163_ID);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $caipiao163->getAwardNumberInfo($fetchExpect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['expect'] = $expect;
             $awardNumberInfo['number'] = explode(' ', $awardNumberInfo['number']);
             foreach ($awardNumberInfo['number'] as &$v) {
                 $v = ltrim($v, '0');
             }
             $awardNumberInfo['number'] = implode(' ', $awardNumberInfo['number']);
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(5);
     }
     //每5秒从www.168kai.com尝试获取开奖数据,共尝试20次
     $source = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $source->getAwardNumberInfo($fetchExpect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['expect'] = $expect;
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(10);
     }
     return false;
 }
Example #2
0
 public function fetchAwardNumberInfo($expect)
 {
     //实际开奖时间延迟60秒左右
     sleep(60);
     //每5秒从caipiao.163.com尝试获取开奖数据,共尝试50次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163('pl5');
     for ($i = 0; $i < 50; $i++) {
         $awardNumberInfo = $caipiao163->resentAwardNum($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(60);
     }
     //每10从www.168kai.com尝试获取开奖数据,共尝试20次
     $source = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $source->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(10);
     }
     return false;
 }
Example #3
0
 public function getAwardNumberListByDate($date)
 {
     $source = new \Lottery\Fetch\Source\Caipiao163('hbkuai3');
     $awardNumberList = $source->getAwardNumberListByDate($date);
     $date_prev = substr($date, 0, 2);
     foreach ($awardNumberList as &$awardNumber) {
         $awardNumber['expect'] = $date_prev . $awardNumber['expect'];
     }
     return $awardNumberList;
 }
Example #4
0
 public function getAwardNumberListByDate($date)
 {
     $source = new \Lottery\Fetch\Source\Caipiao163('11xuan5');
     $awardNumberList = $source->getAwardNumberListByDateAndHtml($date);
     $date_prev = substr($date, 0, 2);
     foreach ($awardNumberList as &$awardNumber) {
         $awardNumber['number'] = explode(' ', $awardNumber['number']);
         foreach ($awardNumber['number'] as &$v) {
             $v = ltrim($v, '0');
         }
         $awardNumber['number'] = implode(' ', $awardNumber['number']);
         $awardNumber['expect'] = $date_prev . $awardNumber['expect'];
     }
     return $awardNumberList;
 }
Example #5
0
 public function fetchAwardNumberInfo($expect)
 {
     //实际开奖时间延迟60秒左右
     sleep(60);
     $fetchExpect = substr($expect, 2);
     //每5秒从www.168kai.com尝试获取开奖数据,共尝试20次
     $lecai = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 30; $i++) {
         $awardNumberInfo = $lecai->getAwardNumberInfo($fetchExpect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['expect'] = $expect;
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(5);
     }
     //每5秒从apiplus尝试获取开奖数据,共尝试20次
     $apiplus = new \Lottery\Fetch\Source\Apiplus('jsk3');
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $apiplus->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(10);
     }
     //每10秒从caipiao.163.com尝试获取开奖数据,共尝试10次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163('oldkuai3');
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $caipiao163->getAwardNumberInfo($fetchExpect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             $awardNumberInfo['expect'] = $expect;
             return $awardNumberInfo;
         }
         sleep(10);
     }
     return false;
 }
Example #6
0
 public function fetchAwardNumberInfo($expect)
 {
     //实际开奖时间延迟35秒左右
     sleep(35);
     $awardNumberInfo = array();
     //每5秒从www.168kai.com尝试获取开奖数据,共尝试20次
     $source = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $source->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', substr($expect, -3) == 120 ? strtotime('-1 day', $this->nowTimestamp) : $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(5);
     }
     //每5秒从caipiao.163.com尝试获取开奖数据,共尝试30次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163('ssc');
     $fetchExpect = substr($expect, 2);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $caipiao163->getAwardNumberInfo($fetchExpect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['expect'] = $expect;
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', substr($expect, -3) == 120 ? strtotime('-1 day', $this->nowTimestamp) : $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(5);
     }
     //每5秒从apiplus尝试获取开奖数据,共尝试20次
     $apiplus = new \Lottery\Fetch\Source\Apiplus('cqssc');
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $apiplus->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', substr($expect, -3) == 120 ? strtotime('-1 day', $this->nowTimestamp) : $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(5);
     }
     return false;
 }
Example #7
0
 public function fetchAwardNumberInfo($expect)
 {
     //实际开奖时间延迟2秒左右
     sleep(2);
     $awardNumberInfo = false;
     //每2秒从caipiao.163.com尝试获取开奖数据,共尝试10次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163('kl8');
     for ($i = 0; $i < 10; $i++) {
         $awardNumberInfo = $caipiao163->resentAwardNum($expect);
         if (!empty($awardNumberInfo)) {
             $numbers = explode(':', $awardNumberInfo['number']);
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             $awardNumberInfo['number'] = $numbers[0];
             return $awardNumberInfo;
         }
         sleep(2);
     }
     //每10从www.168kai.com尝试获取开奖数据,共尝试20次
     $source = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $source->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             $awardNumberInfo['number'] = explode(' ', $awardNumberInfo['number']);
             unset($awardNumberInfo['number'][20]);
             $awardNumberInfo['number'] = implode(' ', $awardNumberInfo['number']);
             return $awardNumberInfo;
         }
         sleep(10);
     }
     return false;
 }
Example #8
0
 public function fetchAwardNumberInfo($expect)
 {
     if ($this->sleep_seconds > 0) {
         sleep($this->sleep_seconds);
     }
     //每10秒从www.168kai.com尝试获取开奖数据,共尝试30次
     $source = new \Lottery\Fetch\Source\Caipiao168kai(self::_168KAI_ID);
     for ($i = 0; $i < 30; $i++) {
         $awardNumberInfo = $source->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(10);
     }
     //每5秒从apiplus尝试获取开奖数据,共尝试20次
     $apiplus = new \Lottery\Fetch\Source\Apiplus('jxssc');
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $apiplus->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(10);
     }
     //每60秒从caipiao.163.com尝试获取开奖数据,共尝试20次
     $caipiao163 = new \Lottery\Fetch\Source\Caipiao163('jxssc');
     for ($i = 0; $i < 20; $i++) {
         $awardNumberInfo = $caipiao163->getAwardNumberInfo($expect);
         if (!empty($awardNumberInfo)) {
             $awardNumberInfo['opendate'] = strtotime(date('Y-m-d', $this->nowTimestamp));
             return $awardNumberInfo;
         }
         sleep(60);
     }
     return false;
 }