Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2009, 13:35
Aper
 
Fecha de Ingreso: marzo-2007
Mensajes: 103
Antigüedad: 17 años, 1 mes
Puntos: 0
Checkear mp3 externo a web

Hola, queria hacer una consulta.. estoy diseñando una web y queria saber de que forma podia hacer en php para saber si una url que contiene un mp3 funciona o no.

Osea, http://www.url.com/archivo.mp3 si funciona lo lea el reproductor, si no funciona que no lo lea y lo salte.


Tenia algo echo pero nose por que no funciona:
Código PHP:
function urlfilesize($url,$thereturn) {
if (
substr($url,0,4)=='http') { 
$x array_change_key_case(get_headers($url1),CASE_LOWER);
$x $x['content-length'];
            }
else { 
$x = @filesize($url); }
if (!
$thereturn) { return $x ; }
elseif(
$thereturn == 'mb') { return round($x / (1024*1024),2) ; }
elseif(
$thereturn == 'kb') { return round($x / (1024),2) ; }

Saludos.-