3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lien = "http://www.hatshowroom.com/chapeaux/8-feutre-monkey-noir-3000008353259.html"; if(urlExist($lien) === FALSE){ echo 'KO'; } else { echo "Good"; } function urlExist($url) { $url = @parse_url($url); if (!$url) return false; $url = array_map('trim', $url); $url['port'] = (!isset($url['port'])) ? 80 : (int)$url['port']; $path = (isset($url['path'])) ? $url['path'] : '/'; $path .= (isset($url['query'])) ? "?$url[query]" : ''; if (isset($url['host']) && $url['host'] != gethostbyname($url['host'])) { $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30); if (!$fp) return false; //socket not opened fputs($fp, "HEAD $path HTTP/1.1rnHost: $url[host]rnrn"); //socket opened $headers = fread($fp, 4096); fclose($fp); if(preg_match('#^HTTP/.*s+[(200|301|302)]+s#i', $headers)){//matching header return true; } else return false; } // if parse url else return false; }
Output for git.master, git.master_jit, rfc.property-hooks
KO

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:
54.27 ms | 401 KiB | 8 Q