当前位置: 首页>>代码示例>>PHP>>正文


PHP SS_Datetime::Rfc2822方法代码示例

本文整理汇总了PHP中SS_Datetime::Rfc2822方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_Datetime::Rfc2822方法的具体用法?PHP SS_Datetime::Rfc2822怎么用?PHP SS_Datetime::Rfc2822使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SS_Datetime的用法示例。


在下文中一共展示了SS_Datetime::Rfc2822方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 public function check()
 {
     $OdeonCinemaID = (int) $this->request->param("ID");
     if ($OdeonCinemaID) {
         if ($this->OdeonCinema = OdeonCinema::get_by_id("OdeonCinema", $OdeonCinemaID)) {
             $this->OdeonCinema->getCurrentFilms();
             $OdeonFilmID = (int) $this->request->param("OtherID");
             if ($OdeonFilmID) {
                 if ($this->OdeonFilm = OdeonFilm::get_by_id("OdeonFilm", $OdeonFilmID)) {
                     $maxdays = 15;
                     $baseURL = "https://www.odeon.co.uk/";
                     $date = new Date();
                     $RestfulService = new RestfulService($baseURL);
                     $i = 0;
                     do {
                         $date->setValue("+{$i} day");
                         if (!OdeonScreening::get("OdeonScreening", implode(" AND ", array("DATE_FORMAT(ScreeningTime,'%d%m%y') = '{$date->Format("dmy")}'", "FilmID='{$OdeonFilmID}'", "CinemaID='{$OdeonCinemaID}'")))->Count()) {
                             $query = array('date' => $date->Format("Y-m-d"), 'siteId' => $OdeonCinemaID, 'filmMasterId' => $OdeonFilmID, 'type' => 'DAY');
                             $RestfulService->setQueryString($query);
                             $Response = $RestfulService->request("showtimes/day");
                             if (!$Response->isError()) {
                                 $html = HtmlDomParser::str_get_html($Response->getBody());
                                 foreach ($html->find('ul') as $ul) {
                                     foreach ($ul->find('li') as $li) {
                                         $ScreeningTime = new SS_Datetime();
                                         $ScreeningTime->setValue("{$date->Format("Y-m-d")} {$li->find('a', 0)->innertext}:00");
                                         $checkAgainstAPI = true;
                                         if ($OdeonScreening = OdeonScreening::get_one("OdeonScreening", implode(" AND ", array("CinemaID='{$OdeonCinemaID}'", "FilmID='{$OdeonFilmID}'", "ScreeningTime='{$ScreeningTime->Rfc2822()}'")))) {
                                             $checkAgainstAPI = $OdeonScreening->checkAgainstAPI();
                                         } else {
                                             $OdeonScreening = new OdeonScreening();
                                             $OdeonScreening->CinemaID = $OdeonCinemaID;
                                             $OdeonScreening->FilmID = $OdeonFilmID;
                                             $OdeonScreening->ScreeningTime = $ScreeningTime->Rfc2822();
                                         }
                                         if ($checkAgainstAPI) {
                                             $URLSegment = str_replace($baseURL, "", $li->find('a', 0)->href);
                                             $Response_init = $RestfulService->request($URLSegment, "GET", null, null, array(CURLOPT_COOKIESESSION => TRUE));
                                             if (!$Response_init->isError()) {
                                                 $dom = new DOMDocument();
                                                 $dom->strictErrorChecking = FALSE;
                                                 libxml_use_internal_errors(true);
                                                 $dom->loadHTML($Response_init->getBody());
                                                 libxml_clear_errors();
                                                 $nodes = $dom->getElementsByTagName('form');
                                                 $submit_url = false;
                                                 $hidden_inputs = array();
                                                 foreach ($nodes as $node) {
                                                     if (!$submit_url && $node->hasAttributes()) {
                                                         foreach ($node->attributes as $attribute) {
                                                             if (!$submit_url && $attribute->nodeName == 'action') {
                                                                 $submit_url = $attribute->nodeValue;
                                                             }
                                                         }
                                                     }
                                                 }
                                                 unset($node);
                                                 $SubmitURL = ltrim($submit_url, '/');
                                                 $Cookies = $Response_init->getHeader("Set-Cookie");
                                                 if (is_array($Cookies)) {
                                                     $Cookies = implode(';', $Cookies);
                                                 }
                                                 $Response_availability = $RestfulService->request($SubmitURL, "GET", null, null, array(CURLOPT_COOKIE => $Cookies));
                                                 if (!$Response_availability->isError()) {
                                                     $html_availability = HtmlDomParser::str_get_html($Response_availability->getBody());
                                                     $ticketsTable = $html_availability->find('#tickets-table', 0);
                                                     if ($ticketsTable) {
                                                         $ticketsForm = $html_availability->find('#tickets', 0);
                                                         $data = array("submit" => null);
                                                         foreach ($ticketsTable->find('select') as $select) {
                                                             $data[$select->attr["name"]] = "0";
                                                         }
                                                         foreach ($ticketsTable->find('tr') as $tr) {
                                                             foreach ($tr->find('td') as $td) {
                                                                 switch ($td->getAttribute("class")) {
                                                                     case "ticket-col":
                                                                         $OdeonScreening->Title = trim($td->innertext);
                                                                         break;
                                                                     case "price-col":
                                                                         $OdeonScreening->Cost = ltrim(explode(" ", trim($td->plaintext))[0], '£');
                                                                         break;
                                                                     case "quantity-col":
                                                                         $Availability = 1;
                                                                         foreach ($td->find('select') as $select) {
                                                                             foreach ($select->find('option') as $option) {
                                                                                 $Availability = $option->attr["value"];
                                                                             }
                                                                             $data[$select->attr["name"]] = $Availability;
                                                                         }
                                                                         $Response_seats = $RestfulService->request(ltrim(html_entity_decode($ticketsForm->attr['action']), "/"), "POST", $data, null, array(CURLOPT_COOKIE => $Cookies));
                                                                         if (!$Response_seats->isError()) {
                                                                             $html_seats = HtmlDomParser::str_get_html($Response_seats->getBody());
                                                                             if (trim($html_seats->find('.step-headline', 0)->innertext) == "Choose your seats") {
                                                                                 $OdeonScreening->Availability = $Availability;
                                                                                 $OdeonScreening->SessionURL = $URLSegment;
                                                                                 $OdeonScreening->duplicate();
                                                                             }
                                                                         }
                                                                         break;
                                                                 }
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:mattclegg-odeon-availability-checker,代码行数:101,代码来源:OdeonPage.php


注:本文中的SS_Datetime::Rfc2822方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。