3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php # build the API URL to call $params = array( 'api_key'=> "fd3fabe4e9d94ca725df1de71b8d285b", 'method'=> "flickr.photos.search", 'tags'=> "torre de belem", 'format'=> "json", ); $encoded_params = array(); foreach ($params as $k => $v){ $encoded_params[] = urlencode($k).'='.urlencode($v); } # call the API and decode the response $url = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); print_r($url); $rsp = file_get_contents($url); $rsp_obj = unserialize($rsp); # display the photo title (or an error if it failed) if ($rsp_obj['stat'] == 'ok'){ $photo_title = $rsp_obj['photo']['title']['_content']; echo "Title is $photo_title!"; }else{ echo "Call failed!"; }
Output for 5.2.6 - 5.4.41, 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 5.6.28, 7.0.0 - 7.0.3, 7.0.5 - 7.1.0
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Call failed!
Output for 5.4.42 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/pHilr on line 23 Call failed!
Output for hhvm-3.10.0 - 3.12.0
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: Failed to open http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json (Could not resolve host: api.flickr.com) in /in/pHilr on line 23 Call failed!
Output for 5.2.0 - 5.2.5
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Connection refused in /in/pHilr on line 23 Call failed!
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.1.6
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Connection refused in /in/pHilr on line 23 Notice: unserialize(): Argument is not a string in /in/pHilr on line 24 Call failed!
Output for 4.3.5 - 4.3.9, 5.0.1 - 5.0.2
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Success in /in/pHilr on line 23 Notice: unserialize(): Argument is not an string in /in/pHilr on line 24 Call failed!
Output for 5.0.0
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Bad file descriptor in /in/pHilr on line 23 Notice: unserialize(): Argument is not an string in /in/pHilr on line 24 Call failed!
Output for 4.3.3 - 4.3.4
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Connection refused in /in/pHilr on line 23 Notice: unserialize(): Argument is not an string in /in/pHilr on line 24 Call failed!
Output for 4.3.2
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json): failed to open stream: Connection refused in /in/pHilr on line 23 Notice: unserialize(): Argument is not an string in /in/pHilr on line 24 Call failed!
Output for 4.3.1
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents() [http://www.php.net/function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json) [http://www.php.net/function.file-get-contents]: failed to create stream: Connection refused in /in/pHilr on line 23 Notice: unserialize() [http://www.php.net/function.unserialize]: Argument is not an string in /in/pHilr on line 24 Call failed!
Output for 4.3.0
http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json Warning: file_get_contents() [http://www.php.net/function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: System error in /in/pHilr on line 23 Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=fd3fabe4e9d94ca725df1de71b8d285b&method=flickr.photos.search&tags=torre+de+belem&format=json) [http://www.php.net/function.file-get-contents]: failed to create stream: Connection refused in /in/pHilr on line 23 Notice: unserialize() [http://www.php.net/function.unserialize]: Argument is not an string in /in/pHilr on line 24 Call failed!