3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Initialisation des variables $clientId = "14254"; $consumerKey = "MTQyNTQ6"; $consumerSecret = "69e94237bdb84f55ba692ef88a925e21"; // Header de la requête $headers = array( "grant_type" => "password", "client_id" => $clientId, "username" => $consumerKey, "password" => $consumerSecret, "content_type" => "application/x-www-form-urlencoded" ); $postText = http_build_query($headers); // URL d'appel $url = "https://api.ccmp.eu/services/authorization/oauth2/token"; try { // Initialisation de la session CURL $curl = curl_init(); // Appel de l'URL en paramètre curl_setopt($curl, CURLOPT_URL, $url); //HTTP POST request curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postText); // Demande le résultat en chaîne de caractères curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Execution de la session CURL $result = curl_exec($curl); // Récupère le code de la réponse retournée $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); // Fermeture de la session CURL curl_close($curl); // Création d'un tableau contenant le code de retour et le résultat de la requête $res = array_merge(array('code' => $code), array('result' => json_decode($result, true))); } catch ( Exception $e ) { throw new Exception("Error during the call. Here the message: " . $e -> Message); } print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 66
Branch analysis from position: 66
2 jumps found. (Code = 107) Position 1 = 67, Position 2 = -2
Branch analysis from position: 67
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/9uIjS
function name:  (null)
number of ops:  77
compiled vars:  !0 = $clientId, !1 = $consumerKey, !2 = $consumerSecret, !3 = $headers, !4 = $postText, !5 = $url, !6 = $curl, !7 = $result, !8 = $code, !9 = $res, !10 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '14254'
    5     1        ASSIGN                                                   !1, 'MTQyNTQ6'
    6     2        ASSIGN                                                   !2, '69e94237bdb84f55ba692ef88a925e21'
   10     3        INIT_ARRAY                                       ~14     'password', 'grant_type'
   11     4        ADD_ARRAY_ELEMENT                                ~14     !0, 'client_id'
   12     5        ADD_ARRAY_ELEMENT                                ~14     !1, 'username'
   13     6        ADD_ARRAY_ELEMENT                                ~14     !2, 'password'
   14     7        ADD_ARRAY_ELEMENT                                ~14     'application%2Fx-www-form-urlencoded', 'content_type'
    9     8        ASSIGN                                                   !3, ~14
   16     9        INIT_FCALL                                               'http_build_query'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $16     
         12        ASSIGN                                                   !4, $16
   19    13        ASSIGN                                                   !5, 'https%3A%2F%2Fapi.ccmp.eu%2Fservices%2Fauthorization%2Foauth2%2Ftoken'
   22    14        INIT_FCALL_BY_NAME                                       'curl_init'
         15        DO_FCALL                                      0  $19     
         16        ASSIGN                                                   !6, $19
   24    17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !6
         19        FETCH_CONSTANT                                   ~21     'CURLOPT_URL'
         20        SEND_VAL_EX                                              ~21
         21        SEND_VAR_EX                                              !5
         22        DO_FCALL                                      0          
   27    23        INIT_FCALL_BY_NAME                                       'curl_setopt'
         24        SEND_VAR_EX                                              !6
         25        FETCH_CONSTANT                                   ~23     'CURLOPT_POST'
         26        SEND_VAL_EX                                              ~23
         27        SEND_VAL_EX                                              <true>
         28        DO_FCALL                                      0          
   28    29        INIT_FCALL_BY_NAME                                       'curl_setopt'
         30        SEND_VAR_EX                                              !6
         31        FETCH_CONSTANT                                   ~25     'CURLOPT_POSTFIELDS'
         32        SEND_VAL_EX                                              ~25
         33        SEND_VAR_EX                                              !4
         34        DO_FCALL                                      0          
   31    35        INIT_FCALL_BY_NAME                                       'curl_setopt'
         36        SEND_VAR_EX                                              !6
         37        FETCH_CONSTANT                                   ~27     'CURLOPT_RETURNTRANSFER'
         38        SEND_VAL_EX                                              ~27
         39        SEND_VAL_EX                                              <true>
         40        DO_FCALL                                      0          
   34    41        INIT_FCALL_BY_NAME                                       'curl_exec'
         42        SEND_VAR_EX                                              !6
         43        DO_FCALL                                      0  $29     
         44        ASSIGN                                                   !7, $29
   36    45        INIT_FCALL_BY_NAME                                       'curl_getinfo'
         46        SEND_VAR_EX                                              !6
         47        FETCH_CONSTANT                                   ~31     'CURLINFO_HTTP_CODE'
         48        SEND_VAL_EX                                              ~31
         49        DO_FCALL                                      0  $32     
         50        ASSIGN                                                   !8, $32
   38    51        INIT_FCALL_BY_NAME                                       'curl_close'
         52        SEND_VAR_EX                                              !6
         53        DO_FCALL                                      0          
   41    54        INIT_FCALL                                               'array_merge'
         55        INIT_ARRAY                                       ~35     !8, 'code'
         56        SEND_VAL                                                 ~35
         57        INIT_FCALL                                               'json_decode'
         58        SEND_VAR                                                 !7
         59        SEND_VAL                                                 <true>
         60        DO_ICALL                                         $36     
         61        INIT_ARRAY                                       ~37     $36, 'result'
         62        SEND_VAL                                                 ~37
         63        DO_ICALL                                         $38     
         64        ASSIGN                                                   !9, $38
         65      > JMP                                                      ->73
   42    66  E > > CATCH                                       last         'Exception'
   43    67    >   NEW                                              $40     'Exception'
         68        FETCH_OBJ_R                                      ~41     !10, 'Message'
         69        CONCAT                                           ~42     'Error+during+the+call.+Here+the+message%3A+', ~41
         70        SEND_VAL_EX                                              ~42
         71        DO_FCALL                                      0          
         72      > THROW                                         0          $40
   46    73    >   INIT_FCALL                                               'print_r'
         74        SEND_VAR                                                 !9
         75        DO_ICALL                                                 
         76      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.44 ms | 1400 KiB | 21 Q