3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Initialisation des variables $clientId = "14254"; $consumerKey = "MTQyNTQ6NDQw"; $consumerSecret = "568a3e7ba52943b78587f2e86d9a57b8"; // 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); //set SSL curl_setopt($curl, CURLOPT_SSLVERSION, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 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 = 86
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 79
Branch analysis from position: 79
2 jumps found. (Code = 107) Position 1 = 80, Position 2 = -2
Branch analysis from position: 80
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/QTjnj
function name:  (null)
number of ops:  90
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, 'MTQyNTQ6NDQw'
    6     2        ASSIGN                                                   !2, '568a3e7ba52943b78587f2e86d9a57b8'
   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_SSLVERSION'
         38        SEND_VAL_EX                                              ~27
         39        SEND_VAL_EX                                              1
         40        DO_FCALL                                      0          
   32    41        INIT_FCALL_BY_NAME                                       'curl_setopt'
         42        SEND_VAR_EX                                              !6
         43        FETCH_CONSTANT                                   ~29     '%C2%A0CURLOPT_SSL_VERIFYPEER'
         44        SEND_VAL_EX                                              ~29
         45        FETCH_CONSTANT                                   ~30     '%C2%A0false'
         46        SEND_VAL_EX                                              ~30
         47        DO_FCALL                                      0          
   35    48        INIT_FCALL_BY_NAME                                       'curl_setopt'
         49        SEND_VAR_EX                                              !6
         50        FETCH_CONSTANT                                   ~32     'CURLOPT_RETURNTRANSFER'
         51        SEND_VAL_EX                                              ~32
         52        SEND_VAL_EX                                              <true>
         53        DO_FCALL                                      0          
   38    54        INIT_FCALL_BY_NAME                                       'curl_exec'
         55        SEND_VAR_EX                                              !6
         56        DO_FCALL                                      0  $34     
         57        ASSIGN                                                   !7, $34
   40    58        INIT_FCALL_BY_NAME                                       'curl_getinfo'
         59        SEND_VAR_EX                                              !6
         60        FETCH_CONSTANT                                   ~36     'CURLINFO_HTTP_CODE'
         61        SEND_VAL_EX                                              ~36
         62        DO_FCALL                                      0  $37     
         63        ASSIGN                                                   !8, $37
   42    64        INIT_FCALL_BY_NAME                                       'curl_close'
         65        SEND_VAR_EX                                              !6
         66        DO_FCALL                                      0          
   45    67        INIT_FCALL                                               'array_merge'
         68        INIT_ARRAY                                       ~40     !8, 'code'
         69        SEND_VAL                                                 ~40
         70        INIT_FCALL                                               'json_decode'
         71        SEND_VAR                                                 !7
         72        SEND_VAL                                                 <true>
         73        DO_ICALL                                         $41     
         74        INIT_ARRAY                                       ~42     $41, 'result'
         75        SEND_VAL                                                 ~42
         76        DO_ICALL                                         $43     
         77        ASSIGN                                                   !9, $43
         78      > JMP                                                      ->86
   46    79  E > > CATCH                                       last         'Exception'
   47    80    >   NEW                                              $45     'Exception'
         81        FETCH_OBJ_R                                      ~46     !10, 'Message'
         82        CONCAT                                           ~47     'Error+during+the+call.+Here+the+message%3A+', ~46
         83        SEND_VAL_EX                                              ~47
         84        DO_FCALL                                      0          
         85      > THROW                                         0          $45
   49    86    >   INIT_FCALL                                               'print_r'
         87        SEND_VAR                                                 !9
         88        DO_ICALL                                                 
         89      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.06 ms | 1404 KiB | 21 Q