3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_google_calendar="https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York"; $url= parse_url($your_google_calendar); $google_domain = $url['scheme'].'://'.$url['host'].dirname($url['path']).'/'; // Load and parse Google's raw calendar $dom = new DOMDocument; $dom->loadHTMLfile($your_google_calendar); // Change Google's CSS file to use absolute URLs (assumes there's only one element) $css = $dom->getElementsByTagName('link')->item(0); $css_href = $css->getAttributes('href'); $css->setAttributes('href', $google_domain . $css_href); // Change Google's JS file to use absolute URLs $scripts = $dom->getElementsByTagName('script')->item(0); foreach ($scripts as $script) { $js_src = $script->getAttributes('src'); if ($js_src) $script->setAttributes('src', $google_domain . $js_src); } // Create a link to a new CSS file called custom_calendar.css $element = $dom->createElement('link'); $element->setAttribute('type', 'text/css'); $element->setAttribute('rel', 'stylesheet'); $element->setAttribute('href', '/custom_calendar.css'); // Append this link at the end of the element $head = $dom->getElementsByTagName('head')->item(0); $head->appendChild($element); // Export the HTML echo $dom->saveHTML(); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 58
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 58
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 57
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/YjNNJ
function name:  (null)
number of ops:  89
compiled vars:  !0 = $your_google_calendar, !1 = $url, !2 = $google_domain, !3 = $dom, !4 = $css, !5 = $css_href, !6 = $scripts, !7 = $script, !8 = $js_src, !9 = $element, !10 = $head
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Fwww.google.com%2Fcalendar%2Fhtmlembed%3Fsrc%3Dcmh3hdnl7d4j8u29t3ekb67cg8%2540group.calendar.google.com%26amp%3Bctz%3DAmerica%2FNew_York'
    4     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $12     
          4        ASSIGN                                                   !1, $12
    6     5        FETCH_DIM_R                                      ~14     !1, 'scheme'
          6        CONCAT                                           ~15     ~14, '%3A%2F%2F'
          7        FETCH_DIM_R                                      ~16     !1, 'host'
          8        CONCAT                                           ~17     ~15, ~16
          9        INIT_FCALL                                               'dirname'
         10        FETCH_DIM_R                                      ~18     !1, 'path'
         11        SEND_VAL                                                 ~18
         12        DO_ICALL                                         $19     
         13        CONCAT                                           ~20     ~17, $19
         14        CONCAT                                           ~21     ~20, '%2F'
         15        ASSIGN                                                   !2, ~21
   10    16        NEW                                              $23     'DOMDocument'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $23
   12    19        INIT_METHOD_CALL                                         !3, 'loadHTMLfile'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0          
   15    22        INIT_METHOD_CALL                                         !3, 'getElementsByTagName'
         23        SEND_VAL_EX                                              'link'
         24        DO_FCALL                                      0  $27     
         25        INIT_METHOD_CALL                                         $27, 'item'
         26        SEND_VAL_EX                                              0
         27        DO_FCALL                                      0  $28     
         28        ASSIGN                                                   !4, $28
   16    29        INIT_METHOD_CALL                                         !4, 'getAttributes'
         30        SEND_VAL_EX                                              'href'
         31        DO_FCALL                                      0  $30     
         32        ASSIGN                                                   !5, $30
   17    33        INIT_METHOD_CALL                                         !4, 'setAttributes'
         34        SEND_VAL_EX                                              'href'
         35        CONCAT                                           ~32     !2, !5
         36        SEND_VAL_EX                                              ~32
         37        DO_FCALL                                      0          
   19    38        INIT_METHOD_CALL                                         !3, 'getElementsByTagName'
         39        SEND_VAL_EX                                              'script'
         40        DO_FCALL                                      0  $34     
         41        INIT_METHOD_CALL                                         $34, 'item'
         42        SEND_VAL_EX                                              0
         43        DO_FCALL                                      0  $35     
         44        ASSIGN                                                   !6, $35
   20    45      > FE_RESET_R                                       $37     !6, ->58
         46    > > FE_FETCH_R                                               $37, !7, ->58
   21    47    >   INIT_METHOD_CALL                                         !7, 'getAttributes'
         48        SEND_VAL_EX                                              'src'
         49        DO_FCALL                                      0  $38     
         50        ASSIGN                                                   !8, $38
   22    51      > JMPZ                                                     !8, ->57
         52    >   INIT_METHOD_CALL                                         !7, 'setAttributes'
         53        SEND_VAL_EX                                              'src'
         54        CONCAT                                           ~40     !2, !8
         55        SEND_VAL_EX                                              ~40
         56        DO_FCALL                                      0          
   20    57    > > JMP                                                      ->46
         58    >   FE_FREE                                                  $37
   25    59        INIT_METHOD_CALL                                         !3, 'createElement'
         60        SEND_VAL_EX                                              'link'
         61        DO_FCALL                                      0  $42     
         62        ASSIGN                                                   !9, $42
   26    63        INIT_METHOD_CALL                                         !9, 'setAttribute'
         64        SEND_VAL_EX                                              'type'
         65        SEND_VAL_EX                                              'text%2Fcss'
         66        DO_FCALL                                      0          
   27    67        INIT_METHOD_CALL                                         !9, 'setAttribute'
         68        SEND_VAL_EX                                              'rel'
         69        SEND_VAL_EX                                              'stylesheet'
         70        DO_FCALL                                      0          
   28    71        INIT_METHOD_CALL                                         !9, 'setAttribute'
         72        SEND_VAL_EX                                              'href'
         73        SEND_VAL_EX                                              '%2Fcustom_calendar.css'
         74        DO_FCALL                                      0          
   30    75        INIT_METHOD_CALL                                         !3, 'getElementsByTagName'
         76        SEND_VAL_EX                                              'head'
         77        DO_FCALL                                      0  $47     
         78        INIT_METHOD_CALL                                         $47, 'item'
         79        SEND_VAL_EX                                              0
         80        DO_FCALL                                      0  $48     
         81        ASSIGN                                                   !10, $48
   31    82        INIT_METHOD_CALL                                         !10, 'appendChild'
         83        SEND_VAR_EX                                              !9
         84        DO_FCALL                                      0          
   33    85        INIT_METHOD_CALL                                         !3, 'saveHTML'
         86        DO_FCALL                                      0  $51     
         87        ECHO                                                     $51
   34    88      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.42 ms | 1404 KiB | 17 Q