3v4l.org

run code in 500+ PHP versions simultaneously
<?php $CLIENT_ID = "5372_dc3n7NvbHBApDwhEUEY5vq9fcaMSsYKnmYNMukC2"; $SECRET = "GFZtdbDOzxbA.ouvKX2ZGYoBL1Bi32cawWxalwL6kBDRZk8gPvZwNitAuROTJ9dl"; $nonce = rtrim(base64_encode(openssl_random_pseudo_bytes(rand(12, 30))), '='); $created = gmdate('Y-m-d\TH:i:s\Z'); $message = $nonce . $created . $CLIENT_ID; $signature = base64_encode(hash_hmac('sha256', $message, $SECRET, true)); $auth_header = 'http://api.soaringspot.com/v1/hmac/v1 ' . 'ClientID="' . $CLIENT_ID . '", ' . 'Signature="' . $signature . '", ' . 'Nonce="' . $nonce . '", ' . 'Created="' . $created . '"'; echo "Nonce: " . $nonce . "\n"; echo "Created: " . $created . "\n"; echo "Auth: " . $auth_header . "\n\n"; $ch = curl_init("https://api.soaringspot.com/v1/contests"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: " . $auth_header, "Accept: application/hal+json", ]); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo "HTTP Code: " . $http_code . "\n"; echo "Response: " . $response . "\n"; ?>
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in /in/ZpZdZ:5 Stack trace: #0 {main} thrown in /in/ZpZdZ on line 5
Process exited with code 255.

preferences:
58.77 ms | 710 KiB | 4 Q