3v4l.org

run code in 300+ PHP versions simultaneously
<?php include_once("config.php"); if($_POST) { $garray = array_filter($_POST["usergroups"]); if (empty($garray)) { die("No group selected"); } //Post variables we received from user $userGroupId = $_POST["usergroups"]; $userMessage = $_POST["message"]; if(strlen($userMessage)<1) { //message is empty die('No message was entered!'); } $link=$_POST['link']; if($link=="http://"){ $link=null; } if($link){ $html=file_get_contents($link) or die("Link unreachable!"); libxml_use_internal_errors(true); $doc = new DomDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $query = '//*/meta[starts-with(@property, \'og:\')]'; $metas = $xpath->query($query); foreach ($metas as $meta) { $property = $meta->getAttribute('property'); $content = $meta->getAttribute('content'); $rmetas[$property] = $content; } $tags=$rmetas; if(!$tags['og:title']){ if (preg_match( '/<title>(.+)<\/title>/', $html,$matches) && isset($matches[1] )) $title = $matches[1]; else $title = $link; $tags['og:title']=$title; } if($_POST['name']){ $tags['og:title']=$_POST['name']; } if(!$tags['og:image']){ $xpath = new DOMXPath($html); $links = $xpath->query('//link[@rel="image_src"]'); foreach ($links as $link) { $tags['og:image'] = $link->nodeValue; } } if(!$tags['og:image']){ $tags['og:image']="http://placehold.it/250x250&text=%C2%A0"; } if(!$tags['og:description']){ $t2=get_meta_tags($link); $tags['og:description']=$t2['description']; } $linkarray=parse_url($link); $msg_body = array( "access_token" => $access_token, "message" => $userMessage, "link" => $link, "picture" => $tags['og:image'], "name" => $tags['og:title'], "caption" => $linkarray['host'], "description" => $tags['og:description'] ); } else { $msg_body = array( "access_token" => $access_token, "message" => $userMessage ); } if ($fbuser) { ?> <html><head><title>Post Status</title><link href="style.css" rel="stylesheet" type="text/css" /></head><body> <div id="fbgroupform" class="groupform" align="center"> <h1>Your post was processed.</h1> <p> <?php if(!is_array($userGroupId)){ echo "error occured!<br/>"; } foreach($userGroupId as $userGroupId){ $fql_query = 'select name from group where gid ='.$userGroupId; $na = $facebook->api(array( 'method' => 'fql.query', 'query' => $fql_query)); foreach($na as $name){ $name=$name['name']; } try { $post_url = '/'.$userGroupId.'/feed'; $postResult = $facebook->api($post_url, 'post', $msg_body ); if($postResult){ echo 'Post success to <a href="//www.facebook.com/groups/'.$userGroupId.'" target="_blank">'.$name.'</a><br/>'; } } catch (FacebookApiException $e) { echo 'Error while posting to '.$name.': '. $e->getMessage()."<br/>"; } } ?> <br/><a class="button" href="<?=$homeurl?>">Back to Main Page</a><br/> </p> </div> </body> </html> <?php }else{ $loginUrl = $facebook->getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>$fbPermissions)); header('Location: ' . $loginUrl); } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 209
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 144
Branch analysis from position: 29
2 jumps found. (Code = 47) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 55, Position 2 = 67
Branch analysis from position: 55
2 jumps found. (Code = 78) Position 1 = 56, Position 2 = 67
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 67
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 87
Branch analysis from position: 72
2 jumps found. (Code = 46) Position 1 = 78, Position 2 = 80
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 84
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 94
Branch analysis from position: 90
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 112
Branch analysis from position: 97
2 jumps found. (Code = 77) Position 1 = 106, Position 2 = 111
Branch analysis from position: 106
2 jumps found. (Code = 78) Position 1 = 107, Position 2 = 111
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
Branch analysis from position: 111
2 jumps found. (Code = 43) Position 1 = 115, Position 2 = 117
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 120, Position 2 = 127
Branch analysis from position: 120
1 jumps found. (Code = 42) Position 1 = 147
Branch analysis from position: 147
2 jumps found. (Code = 43) Position 1 = 148, Position 2 = 199
Branch analysis from position: 148
2 jumps found. (Code = 43) Position 1 = 152, Position 2 = 153
Branch analysis from position: 152
2 jumps found. (Code = 77) Position 1 = 154, Position 2 = 194
Branch analysis from position: 154
2 jumps found. (Code = 78) Position 1 = 155, Position 2 = 194
Branch analysis from position: 155
2 jumps found. (Code = 77) Position 1 = 164, Position 2 = 168
Branch analysis from position: 164
2 jumps found. (Code = 78) Position 1 = 165, Position 2 = 168
Branch analysis from position: 165
1 jumps found. (Code = 42) Position 1 = 164
Branch analysis from position: 164
Branch analysis from position: 168
2 jumps found. (Code = 43) Position 1 = 179, Position 2 = 184
Branch analysis from position: 179
1 jumps found. (Code = 42) Position 1 = 193
Branch analysis from position: 193
1 jumps found. (Code = 42) Position 1 = 154
Branch analysis from position: 154
Branch analysis from position: 184
Branch analysis from position: 168
Branch analysis from position: 194
1 jumps found. (Code = 42) Position 1 = 209
Branch analysis from position: 209
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 194
Branch analysis from position: 153
Branch analysis from position: 199
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 127
Branch analysis from position: 117
Branch analysis from position: 111
Branch analysis from position: 112
Branch analysis from position: 94
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 94
Branch analysis from position: 90
Branch analysis from position: 94
Branch analysis from position: 80
Branch analysis from position: 87
Branch analysis from position: 67
Branch analysis from position: 144
2 jumps found. (Code = 43) Position 1 = 148, Position 2 = 199
Branch analysis from position: 148
Branch analysis from position: 199
Branch analysis from position: 28
Branch analysis from position: 209
Found catch point at position: 185
Branch analysis from position: 185
2 jumps found. (Code = 107) Position 1 = 186, Position 2 = -2
Branch analysis from position: 186
1 jumps found. (Code = 42) Position 1 = 154
Branch analysis from position: 154
filename:       /in/9frZj
function name:  (null)
number of ops:  210
compiled vars:  !0 = $garray, !1 = $userGroupId, !2 = $userMessage, !3 = $link, !4 = $html, !5 = $doc, !6 = $xpath, !7 = $query, !8 = $metas, !9 = $meta, !10 = $property, !11 = $content, !12 = $rmetas, !13 = $tags, !14 = $matches, !15 = $title, !16 = $links, !17 = $t2, !18 = $linkarray, !19 = $msg_body, !20 = $access_token, !21 = $fbuser, !22 = $fql_query, !23 = $na, !24 = $facebook, !25 = $name, !26 = $post_url, !27 = $postResult, !28 = $e, !29 = $homeurl, !30 = $loginUrl, !31 = $fbPermissions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          'config.php', INCLUDE_ONCE
    4     1        FETCH_R                      global              ~33     '_POST'
          2      > JMPZ                                                     ~33, ->209
    6     3    >   INIT_FCALL                                               'array_filter'
          4        FETCH_R                      global              ~34     '_POST'
          5        FETCH_DIM_R                                      ~35     ~34, 'usergroups'
          6        SEND_VAL                                                 ~35
          7        DO_ICALL                                         $36     
          8        ASSIGN                                                   !0, $36
    8     9        ISSET_ISEMPTY_CV                                         !0
         10      > JMPZ                                                     ~38, ->12
    9    11    > > EXIT                                                     'No+group+selected'
   12    12    >   FETCH_R                      global              ~39     '_POST'
         13        FETCH_DIM_R                                      ~40     ~39, 'usergroups'
         14        ASSIGN                                                   !1, ~40
   13    15        FETCH_R                      global              ~42     '_POST'
         16        FETCH_DIM_R                                      ~43     ~42, 'message'
         17        ASSIGN                                                   !2, ~43
   15    18        STRLEN                                           ~45     !2
         19        IS_SMALLER                                               ~45, 1
         20      > JMPZ                                                     ~46, ->22
   18    21    > > EXIT                                                     'No+message+was+entered%21'
   22    22    >   FETCH_R                      global              ~47     '_POST'
         23        FETCH_DIM_R                                      ~48     ~47, 'link'
         24        ASSIGN                                                   !3, ~48
   23    25        IS_EQUAL                                                 !3, 'http%3A%2F%2F'
         26      > JMPZ                                                     ~50, ->28
   24    27    >   ASSIGN                                                   !3, null
   26    28    > > JMPZ                                                     !3, ->144
   27    29    >   INIT_FCALL                                               'file_get_contents'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $52     
         32        ASSIGN                                           ~53     !4, $52
         33      > JMPNZ_EX                                         ~53     ~53, ->36
         34    > > EXIT                                                     'Link+unreachable%21'
         35*       BOOL                                             ~53     <true>
   28    36    >   INIT_FCALL                                               'libxml_use_internal_errors'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                                 
   29    39        NEW                                              $55     'DomDocument'
         40        DO_FCALL                                      0          
         41        ASSIGN                                                   !5, $55
   30    42        INIT_METHOD_CALL                                         !5, 'loadHTML'
         43        SEND_VAR_EX                                              !4
         44        DO_FCALL                                      0          
   31    45        NEW                                              $59     'DOMXPath'
         46        SEND_VAR_EX                                              !5
         47        DO_FCALL                                      0          
         48        ASSIGN                                                   !6, $59
   32    49        ASSIGN                                                   !7, '%2F%2F%2A%2Fmeta%5Bstarts-with%28%40property%2C+%27og%3A%27%29%5D'
   33    50        INIT_METHOD_CALL                                         !6, 'query'
         51        SEND_VAR_EX                                              !7
         52        DO_FCALL                                      0  $63     
         53        ASSIGN                                                   !8, $63
   34    54      > FE_RESET_R                                       $65     !8, ->67
         55    > > FE_FETCH_R                                               $65, !9, ->67
   35    56    >   INIT_METHOD_CALL                                         !9, 'getAttribute'
         57        SEND_VAL_EX                                              'property'
         58        DO_FCALL                                      0  $66     
         59        ASSIGN                                                   !10, $66
   36    60        INIT_METHOD_CALL                                         !9, 'getAttribute'
         61        SEND_VAL_EX                                              'content'
         62        DO_FCALL                                      0  $68     
         63        ASSIGN                                                   !11, $68
   37    64        ASSIGN_DIM                                               !12, !10
         65        OP_DATA                                                  !11
   34    66      > JMP                                                      ->55
         67    >   FE_FREE                                                  $65
   39    68        ASSIGN                                                   !13, !12
   43    69        FETCH_DIM_R                                      ~72     !13, 'og%3Atitle'
         70        BOOL_NOT                                         ~73     ~72
         71      > JMPZ                                                     ~73, ->87
   44    72    >   INIT_FCALL                                               'preg_match'
   45    73        SEND_VAL                                                 '%2F%3Ctitle%3E%28.%2B%29%3C%5C%2Ftitle%3E%2F'
   46    74        SEND_VAR                                                 !4
         75        SEND_REF                                                 !14
         76        DO_ICALL                                         $74     
         77      > JMPZ_EX                                          ~75     $74, ->80
   47    78    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~76     !14, 1
         79        BOOL                                             ~75     ~76
         80    > > JMPZ                                                     ~75, ->84
   48    81    >   FETCH_DIM_R                                      ~77     !14, 1
         82        ASSIGN                                                   !15, ~77
         83      > JMP                                                      ->85
   50    84    >   ASSIGN                                                   !15, !3
   52    85    >   ASSIGN_DIM                                               !13, 'og%3Atitle'
         86        OP_DATA                                                  !15
   54    87    >   FETCH_R                      global              ~81     '_POST'
         88        FETCH_DIM_R                                      ~82     ~81, 'name'
         89      > JMPZ                                                     ~82, ->94
   55    90    >   FETCH_R                      global              ~84     '_POST'
         91        FETCH_DIM_R                                      ~85     ~84, 'name'
         92        ASSIGN_DIM                                               !13, 'og%3Atitle'
         93        OP_DATA                                                  ~85
   57    94    >   FETCH_DIM_R                                      ~86     !13, 'og%3Aimage'
         95        BOOL_NOT                                         ~87     ~86
         96      > JMPZ                                                     ~87, ->112
   60    97    >   NEW                                              $88     'DOMXPath'
         98        SEND_VAR_EX                                              !4
         99        DO_FCALL                                      0          
        100        ASSIGN                                                   !6, $88
   61   101        INIT_METHOD_CALL                                         !6, 'query'
        102        SEND_VAL_EX                                              '%2F%2Flink%5B%40rel%3D%22image_src%22%5D'
        103        DO_FCALL                                      0  $91     
        104        ASSIGN                                                   !16, $91
   62   105      > FE_RESET_R                                       $93     !16, ->111
        106    > > FE_FETCH_R                                               $93, !3, ->111
   63   107    >   FETCH_OBJ_R                                      ~95     !3, 'nodeValue'
        108        ASSIGN_DIM                                               !13, 'og%3Aimage'
        109        OP_DATA                                                  ~95
   62   110      > JMP                                                      ->106
        111    >   FE_FREE                                                  $93
   67   112    >   FETCH_DIM_R                                      ~96     !13, 'og%3Aimage'
        113        BOOL_NOT                                         ~97     ~96
        114      > JMPZ                                                     ~97, ->117
   68   115    >   ASSIGN_DIM                                               !13, 'og%3Aimage'
        116        OP_DATA                                                  'http%3A%2F%2Fplacehold.it%2F250x250%26text%3D%25C2%25A0'
   70   117    >   FETCH_DIM_R                                      ~99     !13, 'og%3Adescription'
        118        BOOL_NOT                                         ~100    ~99
        119      > JMPZ                                                     ~100, ->127
   71   120    >   INIT_FCALL                                               'get_meta_tags'
        121        SEND_VAR                                                 !3
        122        DO_ICALL                                         $101    
        123        ASSIGN                                                   !17, $101
   72   124        FETCH_DIM_R                                      ~104    !17, 'description'
        125        ASSIGN_DIM                                               !13, 'og%3Adescription'
        126        OP_DATA                                                  ~104
   74   127    >   INIT_FCALL                                               'parse_url'
        128        SEND_VAR                                                 !3
        129        DO_ICALL                                         $105    
        130        ASSIGN                                                   !18, $105
   76   131        INIT_ARRAY                                       ~107    !20, 'access_token'
   77   132        ADD_ARRAY_ELEMENT                                ~107    !2, 'message'
   78   133        ADD_ARRAY_ELEMENT                                ~107    !3, 'link'
   79   134        FETCH_DIM_R                                      ~108    !13, 'og%3Aimage'
        135        ADD_ARRAY_ELEMENT                                ~107    ~108, 'picture'
   80   136        FETCH_DIM_R                                      ~109    !13, 'og%3Atitle'
        137        ADD_ARRAY_ELEMENT                                ~107    ~109, 'name'
   81   138        FETCH_DIM_R                                      ~110    !18, 'host'
        139        ADD_ARRAY_ELEMENT                                ~107    ~110, 'caption'
   82   140        FETCH_DIM_R                                      ~111    !13, 'og%3Adescription'
        141        ADD_ARRAY_ELEMENT                                ~107    ~111, 'description'
   75   142        ASSIGN                                                   !19, ~107
        143      > JMP                                                      ->147
   86   144    >   INIT_ARRAY                                       ~113    !20, 'access_token'
   87   145        ADD_ARRAY_ELEMENT                                ~113    !2, 'message'
   85   146        ASSIGN                                                   !19, ~113
   91   147    > > JMPZ                                                     !21, ->199
   93   148    >   ECHO                                                     '%3Chtml%3E%3Chead%3E%3Ctitle%3EPost+Status%3C%2Ftitle%3E%3Clink+href%3D%22style.css%22+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+%2F%3E%3C%2Fhead%3E%3Cbody%3E%0A%3Cdiv+id%3D%22fbgroupform%22+class%3D%22groupform%22+align%3D%22center%22%3E%0A%3Ch1%3EYour+post+was+processed.%3C%2Fh1%3E%0A%3Cp%3E%0A'
   98   149        TYPE_CHECK                                  128  ~115    !1
        150        BOOL_NOT                                         ~116    ~115
        151      > JMPZ                                                     ~116, ->153
   99   152    >   ECHO                                                     'error+occured%21%3Cbr%2F%3E'
  101   153    > > FE_RESET_R                                       $117    !1, ->194
        154    > > FE_FETCH_R                                               $117, !1, ->194
  102   155    >   CONCAT                                           ~118    'select+name+from+group+where+gid+%3D', !1
        156        ASSIGN                                                   !22, ~118
  103   157        INIT_METHOD_CALL                                         !24, 'api'
        158        INIT_ARRAY                                       ~120    'fql.query', 'method'
        159        ADD_ARRAY_ELEMENT                                ~120    !22, 'query'
        160        SEND_VAL_EX                                              ~120
        161        DO_FCALL                                      0  $121    
        162        ASSIGN                                                   !23, $121
  104   163      > FE_RESET_R                                       $123    !23, ->168
        164    > > FE_FETCH_R                                               $123, !25, ->168
  105   165    >   FETCH_DIM_R                                      ~124    !25, 'name'
        166        ASSIGN                                                   !25, ~124
  104   167      > JMP                                                      ->164
        168    >   FE_FREE                                                  $123
  109   169        CONCAT                                           ~126    '%2F', !1
        170        CONCAT                                           ~127    ~126, '%2Ffeed'
        171        ASSIGN                                                   !26, ~127
  110   172        INIT_METHOD_CALL                                         !24, 'api'
        173        SEND_VAR_EX                                              !26
        174        SEND_VAL_EX                                              'post'
        175        SEND_VAR_EX                                              !19
        176        DO_FCALL                                      0  $129    
        177        ASSIGN                                                   !27, $129
  111   178      > JMPZ                                                     !27, ->184
  112   179    >   CONCAT                                           ~131    'Post+success+to+%3Ca+href%3D%22%2F%2Fwww.facebook.com%2Fgroups%2F', !1
        180        CONCAT                                           ~132    ~131, '%22+target%3D%22_blank%22%3E'
        181        CONCAT                                           ~133    ~132, !25
        182        CONCAT                                           ~134    ~133, '%3C%2Fa%3E%3Cbr%2F%3E'
        183        ECHO                                                     ~134
        184    > > JMP                                                      ->193
  114   185  E > > CATCH                                       last         'FacebookApiException'
  115   186    >   CONCAT                                           ~135    'Error+while+posting+to+', !25
        187        CONCAT                                           ~136    ~135, '%3A+'
        188        INIT_METHOD_CALL                                         !28, 'getMessage'
        189        DO_FCALL                                      0  $137    
        190        CONCAT                                           ~138    ~136, $137
        191        CONCAT                                           ~139    ~138, '%3Cbr%2F%3E'
        192        ECHO                                                     ~139
  101   193    > > JMP                                                      ->154
        194    >   FE_FREE                                                  $117
  119   195        ECHO                                                     '%0A%3Cbr%2F%3E%3Ca+class%3D%22button%22+href%3D%22'
  120   196        ECHO                                                     !29
        197        ECHO                                                     '%22%3EBack+to+Main+Page%3C%2Fa%3E%3Cbr%2F%3E%0A%3C%2Fp%3E%0A%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A'
        198      > JMP                                                      ->209
  127   199    >   INIT_METHOD_CALL                                         !24, 'getLoginUrl'
        200        INIT_ARRAY                                       ~140    !29, 'redirect_uri'
        201        ADD_ARRAY_ELEMENT                                ~140    !31, 'scope'
        202        SEND_VAL_EX                                              ~140
        203        DO_FCALL                                      0  $141    
        204        ASSIGN                                                   !30, $141
  128   205        INIT_FCALL                                               'header'
        206        CONCAT                                           ~143    'Location%3A+', !30
        207        SEND_VAL                                                 ~143
        208        DO_ICALL                                                 
  132   209    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.95 ms | 1416 KiB | 27 Q