<?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);
?>
preferences:
53.78 ms | 402 KiB | 5 Q