3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php ob_start(); header ("Content-type: text/xml;"); echo '<?xml version="1.0" encoding="utf-8"?>'."\r\n"; echo '<items>'; $token = '603a0a066a8d71427114723059ef5a17fa1068b53d15a078edbe3ffca357e93c965b8ab84bc4c862c2224'; if(isset($_REQUEST['search'])){ if(isset($_REQUEST['offset'])) if(isset($_REQUEST['hd'])) $url = 'http://api.vk.com/method/video.search.xml?q='.$_REQUEST['search'].'&count=200&sort=1'.$_REQUEST['hd'].'&adult=1'.$_REQUEST['offset'].'&access_token='.$token; $html = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); foreach ($html->video as $item) { $play = $item-> player; $title = $item-> title; $img = $item-> image_medium; echo '<channel><title>'.$title.'</title><description><![CDATA[<table><tr><td style="vertical-align: top"><img src="'.$img.'" height="408" width="410"/><h1></h1></td></tr></table> ]]></description><stream_url><![CDATA['.$play.'&autoplay=1]]></stream_url> </channel>'; }} print("</items>"); $name = $_REQUEST['search']; $page = ob_get_contents(); ob_end_flush(); $fp = fopen("$name.xml","w"); fwrite($fp,$page); fclose($fp); $ftp_server="ftp.byethost10.com"; $ftp_user_name="b10_14110070"; $ftp_user_pass="roja1234"; $file = "$name.xml";//tobe uploaded $remote_file = "/htdocs/s/$name.xml"; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>
based on g6pv9
Output for 7.0.0 - 7.1.0
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 25 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 26 Fatal error: Uncaught Error: Call to undefined function ftp_connect() in /in/KrnTL:35 Stack trace: #0 {main} thrown in /in/KrnTL on line 35
Process exited with code 255.
Output for 5.4.0 - 5.6.28
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 25 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 26 Fatal error: Call to undefined function ftp_connect() in /in/KrnTL on line 35
Process exited with code 255.
Output for 5.3.0 - 5.3.29
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 25 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 26 Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/KrnTL on line 35 Warning: ftp_login() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 38 Warning: ftp_put() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 41 There was a problem while uploading .xml Warning: ftp_close() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 49 <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>
Output for 4.3.3 - 4.3.4, 4.3.10 - 4.4.9, 5.0.3 - 5.2.17
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KrnTL on line 25 Warning: fclose(): supplied argument is not a valid stream resource in /in/KrnTL on line 26 Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/KrnTL on line 35 Warning: ftp_login() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 38 Warning: ftp_put() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 41 There was a problem while uploading .xml Warning: ftp_close() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 49 <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>
Output for 4.3.5 - 4.3.9, 5.0.0 - 5.0.2
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KrnTL on line 25 Warning: fclose(): supplied argument is not a valid stream resource in /in/KrnTL on line 26 Warning: ftp_connect(): php_network_getaddresses: gethostbyname failed in /in/KrnTL on line 35 Warning: ftp_login() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 38 Warning: ftp_put() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 41 There was a problem while uploading .xml Warning: ftp_close() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 49 <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>
Output for 4.3.2
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml): failed to open stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KrnTL on line 25 Warning: fclose(): supplied argument is not a valid stream resource in /in/KrnTL on line 26 Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /in/KrnTL on line 35 Warning: ftp_login() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 38 Warning: ftp_put() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 41 There was a problem while uploading .xml Warning: ftp_close() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 49 <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>
Output for 4.3.0 - 4.3.1
<?xml version="1.0" encoding="utf-8"?> <items></items> Notice: Undefined index: search in /in/KrnTL on line 21 Warning: fopen(.xml) [http://www.php.net/function.fopen]: failed to create stream: Permission denied in /in/KrnTL on line 24 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KrnTL on line 25 Warning: fclose(): supplied argument is not a valid stream resource in /in/KrnTL on line 26 Warning: ftp_connect() [http://www.php.net/function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/KrnTL on line 35 Warning: ftp_login() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 38 Warning: ftp_put() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 41 There was a problem while uploading .xml Warning: ftp_close() expects parameter 1 to be resource, boolean given in /in/KrnTL on line 49 <? $conexion = mysql_connect($mysql_host, $mysql_usuario, $mysql_password, true); $mysql_usuario = 'b10_14110070'; $mysql_password = 'roja1234'; $mysql_host = 'sql207.byethost10.com'; $mysql_database = 'b10_14110070_iptv'; //Seleccionamos la base datos y la conexión. mysql_select_db($mysql_database, $conexion); //Verificamos que no hay ningún error en la conexión if (!$conexion) die('No pudo conectarse: '.mysql_error()); else { //Preparamos la consulta $title = '$name'; $logo_30x30 ='http://www.visual8.co.uk/wp-content/uploads/2013/10/Video-Icon.jpg' ; $description = '$name'; $playlist_url = '$remote_file'; $consulta = "INSERT INTO testme (title, logo_30x30, description, playlist_url)"; $consulta .= "VALUES ('$title', '$logo_30x30', '$description', '$playlist_url')"; //Ejecutamos la consulta $resultado = mysql_query($consulta, $conexion) or die(mysql_error()); echo "<b>ARCHIVO REGISTRADO</b><br><b>nombre:</b> ".$title.", \n <br> <b>logo_30x30:</b> ".$logo_30x30.", \n <br> <b>description:</b> ".$description.", \n <br><br> <b>playlist_url:</b> ".$playlist_url.", \n <br><br>"; } //Cerramos la conexión mysql_close($conexion); ?>