3v4l.org

run code in 300+ PHP versions simultaneously
<?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, $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, $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'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Oqrtv
function name:  (null)
number of ops:  24
compiled vars:  !0 = $request, !1 = $url, !2 = $headers, !3 = $body, !4 = $key, !5 = $concat, !6 = $encrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'POST'
    3     1        ASSIGN                                                   !1, '%2F1.0%2Fwix%2Fsite-events'
    4     2        ASSIGN                                                   !2, <array>
   13     3        ASSIGN                                                   !3, '%7B%22instance-id%22%3A%221328a7fe-e451-8780-d201-0c5d9a1fc02b%22%7D'
   15     4        ASSIGN                                                   !4, '8bbb74b1-8864-47b3-804f-04925bf3ffba'
   37     5        INIT_FCALL                                               'concat'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !3
          9        DO_FCALL                                      0  $12     
         10        ASSIGN                                                   !5, $12
   38    11        INIT_FCALL                                               'hash_hmac'
         12        SEND_VAL                                                 'sha256'
         13        SEND_VAR                                                 !5
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $14     
         16        ASSIGN                                                   !6, $14
   41    17        CONCAT                                           ~16     'The+computed+signature+is+%3A+', !6
         18        CONCAT                                           ~17     ~16, '%3Cbr%2F%3E'
         19        ECHO                                                     ~17
   42    20        FETCH_DIM_R                                      ~18     !2, 'x-wix-signature'
         21        CONCAT                                           ~19     'The+signature+sent+by+Wix+%3A+', ~18
         22        ECHO                                                     ~19
         23      > RETURN                                                   1

Function concat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/Oqrtv
function name:  concat
number of ops:  25
compiled vars:  !0 = $request, !1 = $headers, !2 = $body, !3 = $result, !4 = $url, !5 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   19     3        ASSIGN                                                   !3, ''
   20     4        ASSIGN_OP                                     8          !3, !0
   21     5        ASSIGN_OP                                     8          !3, '%0A'
   22     6        ASSIGN_OP                                     8          !3, !4
   23     7        ASSIGN_OP                                     8          !3, '%0A'
   24     8        INIT_FCALL                                               'ksort'
          9        SEND_REF                                                 !1
         10        DO_ICALL                                                 
   26    11      > FE_RESET_R                                       $12     !1, ->19
         12    > > FE_FETCH_R                                               $12, !5, ->19
   27    13    >   IS_NOT_EQUAL                                             !5, 'x-wix-signature'
         14      > JMPZ                                                     ~13, ->18
   28    15    >   CONCAT                                           ~14     !3, !5
         16        CONCAT                                           ~15     ~14, '%2C'
         17        ASSIGN                                                   !3, ~15
   26    18    > > JMP                                                      ->12
         19    >   FE_FREE                                                  $12
   32    20        CONCAT                                           ~17     !3, '%0A'
         21        CONCAT                                           ~18     ~17, !2
         22        ASSIGN                                                   !3, ~18
   34    23      > RETURN                                                   !3
   35    24*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.71 ms | 1394 KiB | 18 Q