3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $headers = array( 'x-wix-event-type' => '/provision/provision', 'x-wix-timestamp' => '2013-09-30T10:46:38.993Z', 'x-wix-signature' => 'BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I', 'x-wix-application-id' => '1306dc69-eb2f-493d-fc98-f4e693829367', 'x-wix-instance-id'=> '1328a7fe-e451-8780-d201-0c5d9a1fc02b', 'x-wix-event-id'=> '2cdae256-750f-4cc8-bbde-b35018bf8ceb' ); $body = '{"instance-id":"1328a7fe-e451-8780-d201-0c5d9a1fc02b"}'; $key = "8bbb74b1-8864-47b3-804f-04925bf3ffba"; function concat($request, $headers, $body) { $result = ''; $result .= $request; $result .= "\n"; $headers = ksort($headers); foreach ($headers as $header => $value) { if ($header != 'x-wix-signature') { $result = $result . $header . ': ' . $value; } } $result = $result . "\n" . $body . "\n"; return $result; } $concat = concat($request, $headers, $body); $encrypted = hash_hmac('sha256', $concat, $key); $base64 = base64_encode($encrypted); echo "The computed signature is : " . $base64 . "\n"; echo "The signature sent by Wix : " . $headers['x-wix-signature'];
Output for 8.3.0 - 8.3.6
Warning: foreach() argument must be of type array|object, true given in /in/S8PgV on line 24 The computed signature is : ODE1ZmU1NzczMWUzYTY2NDY2ZGRhNmI5NWFhYmNhYTk1Y2I4MWQ5ZWJhYTI2MmEwZWI4NTU1MTMxNGYwNmE4Nw== The signature sent by Wix : BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: foreach() argument must be of type array|object, bool given in /in/S8PgV on line 24 The computed signature is : ODE1ZmU1NzczMWUzYTY2NDY2ZGRhNmI5NWFhYmNhYTk1Y2I4MWQ5ZWJhYTI2MmEwZWI4NTU1MTMxNGYwNmE4Nw== The signature sent by Wix : BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Invalid argument supplied for foreach() in /in/S8PgV on line 24 The computed signature is : ODE1ZmU1NzczMWUzYTY2NDY2ZGRhNmI5NWFhYmNhYTk1Y2I4MWQ5ZWJhYTI2MmEwZWI4NTU1MTMxNGYwNmE4Nw== The signature sent by Wix : BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Warning: Invalid argument supplied for foreach() in /in/S8PgV on line 24 Fatal error: Call to undefined function hash_hmac() in /in/S8PgV on line 36
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: Invalid argument supplied for foreach() in /in/S8PgV on line 24 Fatal error: Call to undefined function: hash_hmac() in /in/S8PgV on line 36
Process exited with code 255.
Output for 4.3.2 - 4.3.10, 4.4.0 - 4.4.4
Warning: Invalid argument supplied for foreach() in /in/S8PgV on line 24 Fatal error: Call to undefined function: hash_hmac() in /in/S8PgV on line 36
Process exited with code 255.
Output for 4.3.11
Fatal error: Call to undefined function: hash_hmac() in /in/S8PgV on line 36
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Invalid argument supplied for foreach() in /in/S8PgV on line 24 Fatal error: Call to undefined function: hash_hmac() in /in/S8PgV on line 36

preferences:
300.73 ms | 401 KiB | 367 Q