3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Your ID and token $blogID = '8070105920543249955'; $authToken = 'OAuth 2.0 token here'; // The data to send to the API $postData = array( 'kind' => 'blogger#post', 'blog' => array('id' => $blogID), 'title' => 'A new post', 'content' => 'With <b>exciting</b> content...' ); // Create the context for the request $context = stream_context_create(array( 'http' => array( // http://www.php.net/manual/en/context.http.php 'method' => 'POST', 'header' => "Authorization: {$authToken}\r\n". "Content-Type: application/json\r\n", 'content' => json_encode($postData) ) )); // Send the request $response = file_get_contents('https://www.googleapis.com/blogger/v3/blogs/'.$blogID.'/posts/', FALSE, $context); // Check for errors if($response === FALSE){ die('Error'); } // Decode the response $responseData = json_decode($response, TRUE); // Print the date from the response echo $responseData['published'];
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 34
Branch analysis from position: 33
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7P8UU
function name:  (null)
number of ops:  42
compiled vars:  !0 = $blogID, !1 = $authToken, !2 = $postData, !3 = $context, !4 = $response, !5 = $responseData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '8070105920543249955'
    4     1        ASSIGN                                                   !1, 'OAuth+2.0+token+here'
    8     2        INIT_ARRAY                                       ~8      'blogger%23post', 'kind'
    9     3        INIT_ARRAY                                       ~9      !0, 'id'
          4        ADD_ARRAY_ELEMENT                                ~8      ~9, 'blog'
   10     5        ADD_ARRAY_ELEMENT                                ~8      'A+new+post', 'title'
   11     6        ADD_ARRAY_ELEMENT                                ~8      'With+%3Cb%3Eexciting%3C%2Fb%3E+content...', 'content'
    7     7        ASSIGN                                                   !2, ~8
   15     8        INIT_FCALL                                               'stream_context_create'
   18     9        INIT_ARRAY                                       ~11     'POST', 'method'
   19    10        ROPE_INIT                                     3  ~13     'Authorization%3A+'
         11        ROPE_ADD                                      1  ~13     ~13, !1
         12        ROPE_END                                      2  ~12     ~13, '%0D%0A'
   20    13        CONCAT                                           ~15     ~12, 'Content-Type%3A+application%2Fjson%0D%0A'
         14        ADD_ARRAY_ELEMENT                                ~11     ~15, 'header'
   21    15        INIT_FCALL                                               'json_encode'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $16     
         18        ADD_ARRAY_ELEMENT                                ~11     $16, 'content'
         19        INIT_ARRAY                                       ~17     ~11, 'http'
         20        SEND_VAL                                                 ~17
         21        DO_ICALL                                         $18     
   15    22        ASSIGN                                                   !3, $18
   26    23        INIT_FCALL                                               'file_get_contents'
         24        CONCAT                                           ~20     'https%3A%2F%2Fwww.googleapis.com%2Fblogger%2Fv3%2Fblogs%2F', !0
         25        CONCAT                                           ~21     ~20, '%2Fposts%2F'
         26        SEND_VAL                                                 ~21
         27        SEND_VAL                                                 <false>
         28        SEND_VAR                                                 !3
         29        DO_ICALL                                         $22     
         30        ASSIGN                                                   !4, $22
   29    31        TYPE_CHECK                                    4          !4
         32      > JMPZ                                                     ~24, ->34
   30    33    > > EXIT                                                     'Error'
   34    34    >   INIT_FCALL                                               'json_decode'
         35        SEND_VAR                                                 !4
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $25     
         38        ASSIGN                                                   !5, $25
   37    39        FETCH_DIM_R                                      ~27     !5, 'published'
         40        ECHO                                                     ~27
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.54 ms | 1400 KiB | 21 Q