3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = 'https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762'; $site = getSiteContent($url); // echo $site; $linksArr = getDomLinks($site); displayArray($linksArr); exit; function getSiteContent($url, $cookieFile = NULL) { $data = file_get_contents($url); return $data; } function getDomLinks($contents) { $linkArr = array(); $dom = new domDocument; @$dom->loadHTML($contents); $links = $dom->getElementsByTagName('a'); foreach ($links as $tag) { $linkArr[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue; } return $linkArr; } function displayArray($aArray) { if (is_array($aArray) && (count($aArray) > 0)) { print("<table border=1>"); print("<tr><th>Key</th><th>Value</th></tr>"); foreach ($aArray as $aKey => $aValue) { print("<tr>"); if (!is_array($aValue)) { if (empty($aValue)) { print("<td>$aKey</td><td><i>$aValue</i></td>"); } else { print("<td>$aKey</td><td>$aValue</td>"); } } else { print("<td>$aKey(array)</td><td>"); displayArray($aValue); print("</td>"); } print("</tr>"); } print("</table>"); } else { print("<i>empty or invalid</i>"); } } ?>
based on slLXK
Output for 5.4.34 - 5.4.38, 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/mSnPf on line 15 Warning: file_get_contents(https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/mSnPf on line 15 <i>empty or invalid</i>
Output for 5.4.39 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/mSnPf on line 15 Warning: file_get_contents(https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/mSnPf on line 15 <i>empty or invalid</i>
Output for 5.3.0 - 5.4.32
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/mSnPf on line 15 Warning: file_get_contents(https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762): failed to open stream: No such file or directory in /in/mSnPf on line 15 <i>empty or invalid</i>
Output for 5.0.0 - 5.2.17
Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/mSnPf on line 15 Warning: file_get_contents(https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762): failed to open stream: No such file or directory in /in/mSnPf on line 15 <i>empty or invalid</i>
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/mSnPf on line 28
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/mSnPf on line 28
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/mSnPf on line 28
Process exited with code 255.