3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); $redirect_uri = 'http://path/to/app/callback'; $url = 'https://getpocket.com/v3/oauth/request'; $data = array('consumer_key' => '27963-b8ab8bc16d50240c6b5aa93b', 'redirect_uri' => $redirect_uri); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded; charset=UTF-8", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); $request_token = str_replace('code=','',$result); $_SESSION['request_token'] = $request_token; header("Location: https://getpocket.com/auth/authorize?request_token=$request_token&redirect_uri=$redirect_uri"); die(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/4ddM4
function name:  (null)
number of ops:  43
compiled vars:  !0 = $redirect_uri, !1 = $url, !2 = $data, !3 = $options, !4 = $context, !5 = $result, !6 = $request_token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'session_start'
          1        DO_ICALL                                                 
    3     2        ASSIGN                                                   !0, 'http%3A%2F%2Fpath%2Fto%2Fapp%2Fcallback'
    4     3        ASSIGN                                                   !1, 'https%3A%2F%2Fgetpocket.com%2Fv3%2Foauth%2Frequest'
    5     4        INIT_ARRAY                                       ~10     '27963-b8ab8bc16d50240c6b5aa93b', 'consumer_key'
          5        ADD_ARRAY_ELEMENT                                ~10     !0, 'redirect_uri'
          6        ASSIGN                                                   !2, ~10
   10     7        INIT_ARRAY                                       ~12     'Content-type%3A+application%2Fx-www-form-urlencoded%3B+charset%3DUTF-8', 'header'
   11     8        ADD_ARRAY_ELEMENT                                ~12     'POST', 'method'
   12     9        INIT_FCALL                                               'http_build_query'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $13     
         12        ADD_ARRAY_ELEMENT                                ~12     $13, 'content'
         13        INIT_ARRAY                                       ~14     ~12, 'http'
    8    14        ASSIGN                                                   !3, ~14
   15    15        INIT_FCALL                                               'stream_context_create'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $16     
         18        ASSIGN                                                   !4, $16
   16    19        INIT_FCALL                                               'file_get_contents'
         20        SEND_VAR                                                 !1
         21        SEND_VAL                                                 <false>
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $18     
         24        ASSIGN                                                   !5, $18
   18    25        INIT_FCALL                                               'str_replace'
         26        SEND_VAL                                                 'code%3D'
         27        SEND_VAL                                                 ''
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                         $20     
         30        ASSIGN                                                   !6, $20
   20    31        FETCH_W                      global              $22     '_SESSION'
         32        ASSIGN_DIM                                               $22, 'request_token'
         33        OP_DATA                                                  !6
   22    34        INIT_FCALL                                               'header'
         35        ROPE_INIT                                     4  ~25     'Location%3A+https%3A%2F%2Fgetpocket.com%2Fauth%2Fauthorize%3Frequest_token%3D'
         36        ROPE_ADD                                      1  ~25     ~25, !6
         37        ROPE_ADD                                      2  ~25     ~25, '%26redirect_uri%3D'
         38        ROPE_END                                      3  ~24     ~25, !0
         39        SEND_VAL                                                 ~24
         40        DO_ICALL                                                 
   23    41      > EXIT                                                     
   25    42*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.39 ms | 1400 KiB | 25 Q