3v4l.org

run code in 300+ PHP versions simultaneously
<?php function callInstagram($url) { $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 2 )); $result = curl_exec($ch); curl_close($ch); return $result; } $tag = 'instabeachpro'; $client_id = "XXXXXXXXXXXXXXXXXXXXX"; $url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id='.$client_id; $inst_stream = callInstagram($url); $results = json_decode($inst_stream, true); //Now parse through the $results array to display your results... foreach($results['data'] as $item){ $image_link = $item['images']['low_resolution']['url']; echo '<img src="'.$image_link.'" />'; }
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.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/ocdD8:4 Stack trace: #0 /in/ocdD8(22): callInstagram('https://api.ins...') #1 {main} thrown in /in/ocdD8 on line 4
Process exited with code 255.
Output for 5.3.6 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/ocdD8 on line 4
Process exited with code 255.

preferences:
226.97 ms | 402 KiB | 301 Q