示例#1
0
 public function __construct()
 {
     $html = Html::get(static::$url);
     if (!$html) {
         throw new \Exception('no html data');
     }
     $this->html = new \simple_html_dom($html);
 }
 private function getStartTimeStamp($matchEl, $match_absolute_url = '')
 {
     $now_time = StringHelper::mk_time_cet();
     $startTimeNode_value = $matchEl->find('div.whenm')[0]->innertext;
     $startTimeString = trim(preg_replace('#<(' . implode('|', ['span', 'b', 'em']) . ')(?:[^>]+)?>.*?</\\1>#s', '', $startTimeNode_value));
     $diff = $this->convertTextTimeToS($startTimeString);
     if (strstr($startTimeNode_value, 'ago')) {
         $start_time = $now_time - $diff;
     } else {
         if (strstr($startTimeNode_value, 'from now')) {
             $start_time = $now_time + $diff;
         }
     }
     $date = date('d-m-Y', $start_time);
     $match_page = Html::get($match_absolute_url);
     if (!$match_page) {
         return null;
     }
     $match_start_time = $match_page->find('.box-shiny-alt')[0]->find('.half')[2]->plaintext;
     $f_date = trim($date . " " . $match_start_time);
     $stamp = StringHelper::mk_time_cet(true, $f_date);
     return $stamp;
 }