3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $url = ''; $headers = array( 'X-Wix-Signature' => '3elavUOF0-I1_7tGz2XZKs_HSlrygsMiblpNFPKv3Ik', "X-Wix-Instance-Id" => "132fc751-9325-63d3-a605-f74e0c25192a", "X-Wix-Event-Id" => "da390885-e72f-4a93-be7f-a90220bac5c7", "X-Wix-Event-Type" => "/provision/provision", "X-Wix-Timestamp" => "2013-10-23T15:39:34.462Z", "X-Wix-Application-Id" => "132fbf95-d58e-f9ed-86e8-48b76f901d91" ); //$body = "{\n\t\"instance-id\": \"1328a7fe-e451-8780-d201-0c5d9a1fc02b\"\n}"; $body = '{"instance-id":"132fc751-9325-63d3-a605-f74e0c25192a"}'; $key = "97cfac6e-b061-4007-a03e-eb4bc199e620"; function concat($request, $url, $headers, $body) { $result = ''; $result .= trim($request); $result .= "\n"; $result .= trim($url); $result .= "\n"; ksort($headers);var_dump($headers); $first = true; foreach ($headers as $header) { if ($header != 'X-Wix-Signature' && $first == true) { $result = $result . trim($header); $first = false; } else if ($header != 'X-Wix-Signature') { $result = $result . ',' . trim($header); } } $result = $result . "\n" . trim($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 . "\n"; echo "The signature sent by Wix : " . $headers['X-Wix-Signature'];

preferences:
46.03 ms | 402 KiB | 5 Q