3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function SaveFile($TYPE,$dataset,$lang) { // Para substituir acentos e cedilhas $patterns[0] = '/[á|â|à|å|ä]/'; $patterns[1] = '/[ð|é|ê|è|ë]/'; $patterns[2] = '/[í|î|ì|ï]/'; $patterns[3] = '/[ó|ô|ò|ø|õ|ö]/'; $patterns[4] = '/[ú|û|ù|ü]/'; $patterns[5] = '/ç/'; $replacements[0] = 'a'; $replacements[1] = 'e'; $replacements[2] = 'i'; $replacements[3] = 'o'; $replacements[4] = 'u'; $replacements[5] = 'c'; //ficheiros em minusculas e sem espacos e em HTML e em Ingles e PT $TYPE2 = strtolower(str_replace (" ", "", $TYPE)); $myFile = "files/".$TYPE2."_".$lang.".php"; $myFile2 = preg_replace($patterns, $replacements, $myFile); $fh = fopen($myFile2, 'a'); //fwrite($fh, "<link rel=\"stylesheet\" type=\"text/css\" href=\"livestream.css\">\n"); //fwrite($fh, "<table>\n"); fwrite($fh, $dataset); //fwrite($fh, "</table>\n"); fclose($fh); } // DEFINIR IDIOMA $LANG=$_REQUEST["lang"]; // EN=1 // PT=22 if($LANG=="pt" OR $LANG==""){ $LANG="22"; $WATCHHERE="Veja aqui"; $link="http://imstore.bet365affiliates.com/Tracker.aspx?AffiliateId=16136&AffiliateCode=365_022055&CID=360&PID=149&TID=3&LNG=22&DID=27"; } if($LANG=="en"){ $LANG="1"; $WATCHHERE="Watch here"; $link="http://imstore.bet365affiliates.com/Tracker.aspx?AffiliateId=16136&AffiliateCode=365_044431&CID=360&PID=149&TID=3&LNG=1&DID=27"; } $dom = new DomDocument; $dom->preserveWhiteSpace = TRUE; $dom->load( 'http://oddsfeed.bet365.com/DiaryStreaming.aspx?LanguageId='.$LANG ); $params = $dom->getElementsByTagName('Event'); // Find Sections $k=0; foreach ($params as $param) //go to each section 1 by 1 { $JOGO = utf8_decode($params->item($k)->getAttribute('EventName')); $EVENTSTART = $params->item($k)->getAttribute('EventStart'); $TYPE_ID = $params->item($k)->getAttribute('ClassificationID'); $TYPE = utf8_decode($params->item($k)->getAttribute('Classification')); $EVENTGROUP = $params->item($k)->getAttribute('EventGroup'); if (preg_match("/portugal/i", $EVENTGROUP)) { $BOLD1="<b>"; $BOLD2="</b>"; } else { $BOLD1=""; $BOLD2=""; } $datetime = new DateTime("$EVENTSTART"); $DATA= $datetime->format('d-m-Y'); $HORA= $datetime->format('H:i'); $i = 0; do { if($TYPE_ID==$i) { $dataset = "<tr><td align='left'>$BOLD1 $DATA - $HORA</td><td align='left'>$BOLD1 $JOGO</td><td align='left'><a target='_blank' href='$link'>$BOLD1 $WATCHHERE $BOLD2</a></td></tr>\n"; SaveFile($TYPE, $dataset, $LANG); } ++$i; } while ($i < 500); $k++; } ?>
Output for 5.3.20 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Notice: Undefined index: lang in /in/6CR86 on line 30 Warning: DOMDocument::load(): php_network_getaddresses: getaddrinfo failed: System error in /in/6CR86 on line 47 Warning: DOMDocument::load(http://oddsfeed.bet365.com/DiaryStreaming.aspx?LanguageId=22): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/6CR86 on line 47 Warning: DOMDocument::load(): I/O warning : failed to load external entity "http://oddsfeed.bet365.com/DiaryStreaming.aspx?LanguageId=22" in /in/6CR86 on line 47
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Notice: Undefined index: lang in /in/6CR86 on line 30 Warning: DOMDocument::load(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/6CR86 on line 47 Warning: DOMDocument::load(http://oddsfeed.bet365.com/DiaryStreaming.aspx?LanguageId=22): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/6CR86 on line 47 Warning: DOMDocument::load(): I/O warning : failed to load external entity "http://oddsfeed.bet365.com/DiaryStreaming.aspx?LanguageId=22" in /in/6CR86 on line 47