3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tsId = 'X1C77CF6EE730D2E88A284D7203D1B20F'; $cacheFileName = '/tmp/'.$tsId.'.xml'; $cacheTimeOut = 43200; // half a day $apiUrl = 'http://www.trustedshops.com/api/ratings/v1/'.$tsId.'.xml'; $xmlFound = false; if ($xml = simplexml_load_file($apiUrl)) { $xPath = "/shop/ratings/result[@name='average']"; $result = (float) $xml -> xpath($xPath); $avg = $result[0]->asXml(); $max = "5.00"; $count = $xml->ratings["amount"]; $shopName = $xml->name; $xmlFound = true; } if ($xmlFound) { ?> <a href="http://www.trustedshops.eu/seller-rating/">Trusted Shops seller rating</a>:<span xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate"> <span rel="v:rating"><span property="v:value"><?php echo $avg;?> </span> </span> / <span property="v:best"><?php echo $max;?> </span> of <span property="v:count"><?php echo $count;?> </span> <a href="https://www.trustedshops.de/bewertung/info_<?php echo $tsId?>.html" title="<?php echo $shopName;?> bewertungen"><?php echo $shopName;?> ratings</a> </span> <?php } function cachecheck($filename_cache, $timeout = 10800) { if (file_exists($filename_cache) && time() - filemtime($filename_cache) < $timeout) { return true; } return false; }
Output for 8.1.0 - 8.1.20, 8.2.0 - 8.2.7
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo for www.trustedshops.com failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): Failed to open stream: php_network_getaddresses: getaddrinfo for www.trustedshops.com failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 8.0.0 - 8.0.29
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): Failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 5.2.6 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.5
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): failed to open stream: Address family not supported by protocol in /in/ccdIW on line 11 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 5.0.3 - 5.0.5
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): failed to open stream: Address family not supported by protocol in /in/ccdIW on line 11 Warning: unknown address famillyI/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 5.0.1 - 5.0.2
Warning: simplexml_load_file(): php_network_getaddresses: gethostbyname failed in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): failed to open stream: No such file or directory in /in/ccdIW on line 11 Warning: unknown address famillyI/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 5.0.0
Warning: simplexml_load_file(): php_network_getaddresses: gethostbyname failed in /in/ccdIW on line 11 Warning: simplexml_load_file(http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml): failed to open stream: Bad file descriptor in /in/ccdIW on line 11 Warning: unknown address famillyI/O warning : failed to load external entity "http://www.trustedshops.com/api/ratings/v1/X1C77CF6EE730D2E88A284D7203D1B20F.xml" in /in/ccdIW on line 11
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_file() in /in/ccdIW on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_file() in /in/ccdIW on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_file() in /in/ccdIW on line 11

preferences:
246.7 ms | 401 KiB | 441 Q