3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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(); ?>
based on ESghh
Output for 7.0.0 - 7.0.3, 7.0.5 - 7.1.0
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Uncaught Error: Call to a member function getAttributes() on null in /in/YjNNJ:16 Stack trace: #0 {main} thrown in /in/YjNNJ on line 16
Process exited with code 255.
Output for 7.0.4
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Uncaught Error: Call to a member function getAttributes() on null in /in/YjNNJ:16 Stack trace: #0 {main} thrown in /in/YjNNJ on line 16
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: Protocol 'https' for external XML entity 'https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York' is disabled for security reasons. This may be changed using the hhvm.libxml.ext_entity_whitelist ini setting. Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function getAttributes() on a non-object (null)' in /in/YjNNJ:16 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.8 - 5.6.17, 5.6.20 - 5.6.28
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on null in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.6.18 - 5.6.19
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on null in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.4.34 - 5.4.38, 5.5.24 - 5.5.32, 5.5.34 - 5.5.35
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on a non-object in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.4.39 - 5.4.45, 5.5.33
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on a non-object in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.3.0 - 5.4.32
Warning: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on a non-object in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Notice: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/YjNNJ on line 12 Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on a non-object in /in/YjNNJ on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Notice: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/YjNNJ on line 12 Notice: DOMDocument::loadHTMLFile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/YjNNJ on line 12 Warning: I/O warning : failed to load external entity "https://www.google.com/calendar/htmlembed?src=cmh3hdnl7d4j8u29t3ekb67cg8%40group.calendar.google.com&amp;ctz=America/New_York" in /in/YjNNJ on line 12 Fatal error: Call to a member function getAttributes() on a non-object in /in/YjNNJ on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/YjNNJ on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/YjNNJ on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/YjNNJ on line 15
Process exited with code 255.