Exemplo n.º 1
0
 /**
  * Return the DOMDocument of the base menu URL
  */
 protected function getDOMDocument()
 {
     $html = getHTMLFromURL($this->getBaseMenuURL());
     $doc = new DOMDocument();
     if (empty($html)) {
         return $doc;
     }
     $doc->validateOnParse = true;
     $doc->loadHTML($html);
     return $doc;
 }
Exemplo n.º 2
0
function getWhiteHorse()
{
    global $weekEndText, $websiteNotAvailable, $menuFormat, $WhiteHorseBaseMenuURL;
    if (isWeekend()) {
        return $weekEndText;
    }
    $fallback = sprintf($menuFormat, $WhiteHorseBaseMenuURL);
    $html = getHTMLFromURL($WhiteHorseBaseMenuURL . 'crbst_4.html');
    if (empty($html)) {
        return $fallback;
    }
    $doc = new DOMDocument();
    $doc->loadHTML($html);
    $finder = new DomXPath($doc);
    $spaner = $finder->query("//*[contains(@class, 'wa-but-txt ')]");
    // get first <a>
    if ($spaner->length > 0) {
        $pdfLink = $spaner->item(0);
        return sprintf($menuFormat, getBaseURL($WhiteHorseBaseMenuURL) . $pdfLink->getAttribute('href'));
    }
    return $fallback;
}