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"}'; echo "the body is " . trim($body); $key = "8bbb74b1-8864-47b3-804f-04925bf3ffba"; function concat($request, $url, $headers, $body) { $result = ''; $result .= trim($request); $result .= "\n"; $result .= trim($url); $result .= "\n"; ksort($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'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SLOOt
function name:  (null)
number of ops:  30
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%22+++instance-id%22%3A%221328a7fe-e451-8780-d201-0c5d9a1fc02b%22%7D'
   14     4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !3
          6        DO_ICALL                                         $11     
          7        CONCAT                                           ~12     'the+body+is+', $11
          8        ECHO                                                     ~12
   16     9        ASSIGN                                                   !4, '8bbb74b1-8864-47b3-804f-04925bf3ffba'
   42    10        INIT_FCALL                                               'concat'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !3
         15        DO_FCALL                                      0  $14     
         16        ASSIGN                                                   !5, $14
   43    17        INIT_FCALL                                               'hash_hmac'
         18        SEND_VAL                                                 'sha256'
         19        SEND_VAR                                                 !5
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $16     
         22        ASSIGN                                                   !6, $16
   46    23        CONCAT                                           ~18     'The+computed+signature+is+%3A+', !6
         24        CONCAT                                           ~19     ~18, '%0A'
         25        ECHO                                                     ~19
   47    26        FETCH_DIM_R                                      ~20     !2, 'x-wix-signature'
         27        CONCAT                                           ~21     'The+signature+sent+by+Wix+%3A+', ~20
         28        ECHO                                                     ~21
         29      > RETURN                                                   1

Function concat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 42
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 41
Branch analysis from position: 25
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/SLOOt
function name:  concat
number of ops:  51
compiled vars:  !0 = $request, !1 = $url, !2 = $headers, !3 = $body, !4 = $result, !5 = $first, !6 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   20     4        ASSIGN                                                   !4, ''
   21     5        INIT_FCALL                                               'trim'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN_OP                                     8          !4, $8
   22     9        ASSIGN_OP                                     8          !4, '%0A'
   23    10        INIT_FCALL                                               'trim'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $11     
         13        ASSIGN_OP                                     8          !4, $11
   24    14        ASSIGN_OP                                     8          !4, '%0A'
   25    15        INIT_FCALL                                               'ksort'
         16        SEND_REF                                                 !2
         17        DO_ICALL                                                 
   27    18        ASSIGN                                                   !5, <true>
   28    19      > FE_RESET_R                                       $16     !2, ->42
         20    > > FE_FETCH_R                                               $16, !6, ->42
   29    21    >   IS_NOT_EQUAL                                     ~17     !6, 'x-wix-signature'
         22      > JMPZ_EX                                          ~17     ~17, ->25
         23    >   BOOL                                             ~18     !5
         24        BOOL                                             ~17     ~18
         25    > > JMPZ                                                     ~17, ->33
   30    26    >   INIT_FCALL                                               'trim'
         27        SEND_VAR                                                 !6
         28        DO_ICALL                                         $19     
         29        CONCAT                                           ~20     !4, $19
         30        ASSIGN                                                   !4, ~20
   31    31        ASSIGN                                                   !5, <false>
         32      > JMP                                                      ->41
   32    33    >   IS_NOT_EQUAL                                             !6, 'x-wix-signature'
         34      > JMPZ                                                     ~23, ->41
   33    35    >   CONCAT                                           ~24     !4, '%2C'
         36        INIT_FCALL                                               'trim'
         37        SEND_VAR                                                 !6
         38        DO_ICALL                                         $25     
         39        CONCAT                                           ~26     ~24, $25
         40        ASSIGN                                                   !4, ~26
   28    41    > > JMP                                                      ->20
         42    >   FE_FREE                                                  $16
   37    43        CONCAT                                           ~28     !4, '%0A'
         44        INIT_FCALL                                               'trim'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                         $29     
         47        CONCAT                                           ~30     ~28, $29
         48        ASSIGN                                                   !4, ~30
   39    49      > RETURN                                                   !4
   40    50*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.24 ms | 1407 KiB | 20 Q