3v4l.org

run code in 300+ PHP versions simultaneously
<?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>"); } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
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(): open_basedir restriction in effect. File(https://secure.i-web.ch/dweb/uri/de/behoerdenmain/gerichtetop/rechtsprechung/?action=info&pubid=4762) is not within the allowed path(s): (/tmp:/in:/etc) 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: Operation not permitted in /in/mSnPf on line 15 Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /in/mSnPf:24 Stack trace: #0 /in/mSnPf(24): DOMDocument->loadHTML('') #1 /in/mSnPf(8): getDomLinks(false) #2 {main} thrown in /in/mSnPf on line 24
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.51 ms | 402 KiB | 8 Q