Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/02/2008, 08:08
Avatar de jcxnet
jcxnet
 
Fecha de Ingreso: octubre-2005
Ubicación: Perú
Mensajes: 784
Antigüedad: 18 años, 7 meses
Puntos: 56
Re: detectar dominio padre php

Yo uso esta para detectar el dominio de una página, pero la puedes modificar para que le envíes la URL y te devuelva lo que necesitas:
Código PHP:
function strleft($s1$s2) { return substr($s10strpos($s1$s2));}

function 
selfURL() { 
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" ""
$protocol strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); 
$URL $protocol."://".$_SERVER['SERVER_NAME']."/";
$pos strpos($URL"www.");
if (
$pos === false){
    
$pos strlen("http://");
    
$URL substr($URL,0,$pos).'www.'.substr($URL,$pos);
}
return 
$URL;

__________________
►I'm a devil on the run ♂
Jcxnet.com
*Keep It Simple **