3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-type: application/json"); $url = "http://ipinfo.io/" . $_SERVER['REMOTE_ADDR'] . "/json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); curl_close($ch); print json_encode($output); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined array key "REMOTE_ADDR" in /in/aSihQ on line 3 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/aSihQ:4 Stack trace: #0 {main} thrown in /in/aSihQ on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined index: REMOTE_ADDR in /in/aSihQ on line 3 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/aSihQ:4 Stack trace: #0 {main} thrown in /in/aSihQ on line 4
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/aSihQ:4 Stack trace: #0 {main} thrown in /in/aSihQ on line 4
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Notice: Undefined index: REMOTE_ADDR in /in/aSihQ on line 3 Fatal error: Call to undefined function curl_init() in /in/aSihQ on line 4
Process exited with code 255.

preferences:
181.27 ms | 402 KiB | 265 Q