3v4l.org

run code in 300+ PHP versions simultaneously
<ul> <?php //function to retrieve posts from facebook’s server function loadFB($fbID){ $url = "http://graph.facebook.com/".$fbID."/feed?limit=3"; // Update by MC Vooges 11jun 2014: Access token is now required: $url.= '&access_token=YOUR_TOKEN|YOUR_ACCESS_SECRET';// * //load and setup CURL $c = curl_init($url); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); //get data from facebook and decode JSON $page = json_decode(curl_exec($c)); //close the connection curl_close($c); //return the data as an object return $page->data; } /* Change These Values */ // Your Facebook ID $fbid = "190506416472588"; // How many posts to show? $fbLimit = 10; // Your Timezone date_default_timezone_set("America/Chicago"); /* Dont Change */ // Variable used to count how many we’ve loaded $fbCount = 0; // Call the function and get the posts from facebook $myPosts = loadFB($fbid); //loop through all the posts we got from facebook foreach($myPosts as $dPost){ //only show posts that are posted by the page admin if($dPost->from->id==$fbid){ //get the post date / time and convert to unix time $dTime = strtotime($dPost->created_time); //format the date / time into something human readable //if you want it formatted differently look up the php date function $myTime=date("M d Y h:ia",$dTime); ?> <ul> <li><?php echo($dPost->message) . $myTime; ?></li> </ul> <?php //increment counter $fbCount++; //if we’ve outputted the number set above in fblimit we’re done if($fbCount >= $fbLimit) break; } } ?> </ul>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 37
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 37
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 36
Branch analysis from position: 37
Branch analysis from position: 37
filename:       /in/oLnpf
function name:  (null)
number of ops:  40
compiled vars:  !0 = $fbid, !1 = $fbLimit, !2 = $fbCount, !3 = $myPosts, !4 = $dPost, !5 = $dTime, !6 = $myTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Cul%3E%0A'
   22     1        ASSIGN                                                   !0, '190506416472588'
   24     2        ASSIGN                                                   !1, 10
   26     3        INIT_FCALL                                               'date_default_timezone_set'
          4        SEND_VAL                                                 'America%2FChicago'
          5        DO_ICALL                                                 
   31     6        ASSIGN                                                   !2, 0
   33     7        INIT_FCALL                                               'loadfb'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $11     
         10        ASSIGN                                                   !3, $11
   37    11      > FE_RESET_R                                       $13     !3, ->37
         12    > > FE_FETCH_R                                               $13, !4, ->37
   39    13    >   FETCH_OBJ_R                                      ~14     !4, 'from'
         14        FETCH_OBJ_R                                      ~15     ~14, 'id'
         15        IS_EQUAL                                                 !0, ~15
         16      > JMPZ                                                     ~16, ->36
   41    17    >   INIT_FCALL                                               'strtotime'
         18        FETCH_OBJ_R                                      ~17     !4, 'created_time'
         19        SEND_VAL                                                 ~17
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !5, $18
   44    22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 'M+d+Y+h%3Aia'
         24        SEND_VAR                                                 !5
         25        DO_ICALL                                         $20     
         26        ASSIGN                                                   !6, $20
   46    27        ECHO                                                     '++++++++%3Cul%3E%0A++++++++++++%3Cli%3E'
   47    28        FETCH_OBJ_R                                      ~22     !4, 'message'
         29        CONCAT                                           ~23     ~22, !6
         30        ECHO                                                     ~23
         31        ECHO                                                     '%3C%2Fli%3E%0A++++++++%3C%2Ful%3E%0A++++++++'
   51    32        PRE_INC                                                  !2
   53    33        IS_SMALLER_OR_EQUAL                                      !1, !2
         34      > JMPZ                                                     ~25, ->36
         35    > > JMP                                                      ->37
   37    36    > > JMP                                                      ->12
         37    >   FE_FREE                                                  $13
   57    38        ECHO                                                     '%3C%2Ful%3E'
         39      > RETURN                                                   1

Function loadfb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oLnpf
function name:  loadFB
number of ops:  28
compiled vars:  !0 = $fbID, !1 = $url, !2 = $c, !3 = $page
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        CONCAT                                           ~4      'http%3A%2F%2Fgraph.facebook.com%2F', !0
          2        CONCAT                                           ~5      ~4, '%2Ffeed%3Flimit%3D3'
          3        ASSIGN                                                   !1, ~5
    7     4        ASSIGN_OP                                     8          !1, '%26access_token%3DYOUR_TOKEN%7CYOUR_ACCESS_SECRET'
   10     5        INIT_FCALL_BY_NAME                                       'curl_init'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   11     9        INIT_FCALL_BY_NAME                                       'curl_setopt'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~10     'CURLOPT_RETURNTRANSFER'
         12        SEND_VAL_EX                                              ~10
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0          
   13    15        INIT_FCALL                                               'json_decode'
         16        INIT_FCALL_BY_NAME                                       'curl_exec'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $12     
         19        SEND_VAR                                                 $12
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !3, $13
   15    22        INIT_FCALL_BY_NAME                                       'curl_close'
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0          
   17    25        FETCH_OBJ_R                                      ~16     !3, 'data'
         26      > RETURN                                                   ~16
   18    27*     > RETURN                                                   null

End of function loadfb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
284 ms | 1021 KiB | 18 Q