3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_google_calendar="https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo"; $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 = $dom->getElementsByTagName('link'); foreach ($css as $link) { $css_href = $link->getAttribute('href'); if ($css_href) $$link->setAttribute('href', $google_domain . $css_href); } //$css_href = $css->getAttribute('href'); //$css->setAttribute('href', $google_domain . $css_href); // Change Google's JS file to use absolute URLs $scripts = $dom->getElementsByTagName('script'); foreach ($scripts as $script) { $js_src = $script->getAttribute('src'); if ($js_src) $script->setAttribute('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 //DOMNodeList $head = $dom->getElementsByTagName('head'); // $head = $dom->getElementsByTagName('head')->item(0); echo($head); $head->appendChild($element); // Export the HTML //echo $dom->saveHTML(); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/ESghh on line 7 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo" in /in/ESghh on line 7 Fatal error: Uncaught Error: Call to a member function appendChild() on null in /in/ESghh:34 Stack trace: #0 {main} thrown in /in/ESghh on line 34
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Warning: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/ESghh on line 7 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo" in /in/ESghh on line 7 Fatal error: Call to a member function appendChild() on null in /in/ESghh on line 34
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Warning: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/ESghh on line 7 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo" in /in/ESghh on line 7 Fatal error: Call to a member function appendChild() on a non-object in /in/ESghh on line 34
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo" in /in/ESghh on line 7 Fatal error: Call to a member function appendChild() on a non-object in /in/ESghh on line 34
Process exited with code 255.
Output for 5.1.3 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Warning</b>: DOMDocument::loadHTMLFile() [<a href='function.DOMDocument-loadHTMLFile'>function.DOMDocument-loadHTMLFile</a>]: I/O warning : failed to load external entity &quot;https://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;height=800&amp;wkst=1&amp;hl=pt_BR&amp;bgcolor=%23FFFFFF&amp;src=tprotegetreinamentos%40gmail.com&amp;color=%23BE6D00&amp;ctz=America%2FSao_Paulo&quot; in <b>/in/ESghh</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Call to a member function appendChild() on a non-object in <b>/in/ESghh</b> on line <b>34</b><br />
Process exited with code 255.
Output for 5.1.0 - 5.1.2
<br /> <b>Warning</b>: DOMDocument::loadHTMLFile() [<a href='function.loadHTMLFile'>function.loadHTMLFile</a>]: I/O warning : failed to load external entity &quot;https://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;height=800&amp;wkst=1&amp;hl=pt_BR&amp;bgcolor=%23FFFFFF&amp;src=tprotegetreinamentos%40gmail.com&amp;color=%23BE6D00&amp;ctz=America%2FSao_Paulo&quot; in <b>/in/ESghh</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Call to a member function appendChild() on a non-object in <b>/in/ESghh</b> on line <b>34</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Warning</b>: I/O warning : failed to load external entity "https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showCalendars=0&height=800&wkst=1&hl=pt_BR&bgcolor=%23FFFFFF&src=tprotegetreinamentos%40gmail.com&color=%23BE6D00&ctz=America%2FSao_Paulo" in <b>/in/ESghh</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Call to a member function appendChild() on a non-object in <b>/in/ESghh</b> on line <b>34</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>/in/ESghh</b> on line <b>32</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_OBJECT_OPERATOR in <b>/in/ESghh</b> on line <b>32</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/ESghh</b> on line <b>32</b><br />
Process exited with code 255.

preferences:
261.3 ms | 401 KiB | 468 Q