3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $request = 'POST'; $url = '/1.0/wix/site-events'; $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, $url, $headers, $body) { $result = ''; $result .= $request; $result .= "\n"; $result .= $url; $result .= "\n"; ksort($headers); foreach ($headers as $header) { if ($header != 'x-wix-signature') { $result = $result . $header . ','; } } $result = $result . "\n" . $body; return $result; } $concat = concat($request, $url, $headers, $body); $encrypted = hash_hmac('sha256', $concat, $key); //$base64 = base64_encode($encrypted); echo "The computed signature is : " . $encrypted . "<br/>"; echo "The signature sent by Wix : " . $headers['x-wix-signature'];
Output for 5.1.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
The computed signature is : d85bcf33906343b31cc92697a724f897e53f97a5d36d03dcfd80999a0bbea4d3<br/>The signature sent by Wix : BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I
Output for 5.0.0 - 5.1.1
Fatal error: Call to undefined function hash_hmac() in /in/2Sbcv on line 38
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: hash_hmac() in /in/2Sbcv on line 38
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: hash_hmac() in /in/2Sbcv on line 38
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: hash_hmac() in /in/2Sbcv on line 38