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) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); $data = curl_exec($ch); curl_close($ch); 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
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/slLXK:15 Stack trace: #0 /in/slLXK(5): getSiteContent('https://secure....') #1 {main} thrown in /in/slLXK on line 15
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:
37.5 ms | 401 KiB | 8 Q