3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = 'http://sandbox.case-store.ch/images/27-12-2014 13-50-47.png'; $var2 = 'sandbox.case-store.ch/images/27-12-2014 13-50-47.png'; function getImageContentRaw($url) { try { echo 'Stage0'; return file_get_contents(rawurlencode($url)); } catch (PHPException $ex) { // Ignore error and try http and https prefix } if (substr($url, 0, 7) === 'http://' || substr($url, 0, 7) === 'https://') { echo 'Stage9'; return false; } try { echo 'Stage1'; return file_get_contents(urlencode('https://'.$url)); } catch (PHPException $ex) { // Ignore error } try { echo 'Stage2'; return file_get_contents(urlencode('http://' . $url)); } catch (PHPException $ex) { // Ignore error } echo 'Stage8'; return false; } var_dump(getImageContentRaw($var)); var_dump(getImageContentRaw($var2));

preferences:
54.97 ms | 405 KiB | 6 Q