3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getXML($url) { $Proxy = getenv("HTTP_PROXY"); if (strlen($Proxy) > 1) { $r_default_context = stream_context_get_default(array('http' => array('proxy' => $Proxy,'request_fulluri' => True,),)); libxml_set_streams_context($r_default_context); } $daten = simplexml_load_file($url); return ($daten); } ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); ini_set("max_execution_time", 0); ini_set("memory_limit", "10000M"); //These are here to hold back any errors from a user agent sniffer, if applicable. //I only put these here as a precaution and to add things to my code to make it look //like I was doing something important. echo "\t\t\t\t\t",'<div class="row center">',PHP_EOL; //For bootstrap, to wrap the videos up in a row so they can be displayed properly $user = 'KazenRacing'; //Set the username for later use $xml = getXML("http://gdata.youtube.com/feeds/api/users/$user/uploads"); //Loads the users Youtube feed data $total = $xml->totalResults; //This will give you how many videos are available in the feed for ($i=0; $i < $total; $i++){ //For loop determining how many videos to display based on the $total $id = basename($xml->entry[$i]->id); //This gets the id for each video. $title = $xml->entry[$i]->title; //This will get the title for each video. $recorded = date('jS F, Y', strtotime($xml->entry[$i]->recorded)); //This will get the recorded time of each video and display it by Day Month, Year. If not set will display 31st December, 1969 $description= $xml->entry[$i]->content; //This will get the video description, if any. echo "\t\t\t\t\t\t", '<div class="col-md-3 col-sm-6 col-xs-9 yt-div">',PHP_EOL, "\t\t\t\t\t\t\t", '<div class="well well-sm text-center">',PHP_EOL, "\t\t\t\t\t\t\t\t", '<h4>'.$title.'</h4>',PHP_EOL, "\t\t\t\t\t\t\t\t", '<div class="caption">',PHP_EOL, "\t\t\t\t\t\t\t\t\t", '<h5>'.$recorded.'</h5>',PHP_EOL, "\t\t\t\t\t\t\t\t\t",'<a rel="Video Gallery" class="swipebox" href="//youtu.be/'.$id.'" title="'.$title.'">', PHP_EOL, "\t\t\t\t\t\t\t\t\t\t",'<img src="thumbs.php?src=http://img.youtube.com/vi/'.$id.'/mqdefault.jpg&w=256" class="img-responsive img-thumb center-block" alt="'.$title.'"></a>',PHP_EOL, "\t\t\t\t\t\t\t\t\t",'<h6 class="text-justify">'.$description.'</h6>',PHP_EOL, "\t\t\t\t\t\t\t\t",'<hr>',PHP_EOL,//"\t\t\t\t\t\t\t\t\t",'<a href="//youtu.be/'.$id.'" class="btn btn-info btn-outlined" role="button">View on Youtube</a>',PHP_EOL, "\t\t\t\t\t\t\t\t", '</div>',PHP_EOL, "\t\t\t\t\t\t", '</div>', PHP_EOL, "\t\t\t\t\t", '</div>',PHP_EOL; //This echo displays all the information we set before using the $id, $title, $recorded, and $description variables. if ($i % 4 == 3) { echo "\t\t\t\t\t",'</div>',PHP_EOL, "\t\t\t\t\t",'<div class="row">',PHP_EOL; } //This if statement makes sure there is a new row for every four videos. } echo "\t\t\t\t\t",'</div>',PHP_EOL; //And here is the closing tag for our row div. ?>
Output for 5.2.6 - 7.1.0
<div class="row center"> Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/702ZZ on line 10 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div>
Output for 5.1.0 - 5.2.5
<div class="row center"> Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: Connection refused in /in/702ZZ on line 10 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div>
Output for 5.0.3 - 5.0.5
<div class="row center"> Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: Connection refused in /in/702ZZ on line 10 Warning: connection refusedI/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div>
Output for 5.0.2
<div class="row center"> Warning: simplexml_load_file(): php_network_getaddresses: gethostbyname failed in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: Success in /in/702ZZ on line 10 Warning: connection refusedI/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div>
Output for 5.0.1
<div class="row center"> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 21 PHP_EOL Warning: simplexml_load_file(): php_network_getaddresses: gethostbyname failed in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: Success in /in/702ZZ on line 10 Warning: connection refusedI/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 51 PHP_EOL
Output for 5.0.0
<div class="row center"> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 21 PHP_EOL Warning: simplexml_load_file(): php_network_getaddresses: gethostbyname failed in /in/702ZZ on line 10 Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads): failed to open stream: Bad file descriptor in /in/702ZZ on line 10 Warning: connection refusedI/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/users/KazenRacing/uploads" in /in/702ZZ on line 10 Notice: Trying to get property of non-object in /in/702ZZ on line 26 </div> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 51 PHP_EOL
Output for 4.4.5 - 4.4.9
<div class="row center"> Fatal error: Call to undefined function: simplexml_load_file() in /in/702ZZ on line 10
Process exited with code 255.
Output for 4.3.10 - 4.4.4
<div class="row center"> Fatal error: Call to undefined function: simplexml_load_file() in /in/702ZZ on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.9
<div class="row center"> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 21 PHP_EOL Fatal error: Call to undefined function: simplexml_load_file() in /in/702ZZ on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<div class="row center"> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/702ZZ on line 21 PHP_EOL Fatal error: Call to undefined function: simplexml_load_file() in /in/702ZZ on line 10