Foros del Web » Programando para Internet » PHP »

PHP Ping

Estas en el tema de PHP Ping en el foro de PHP en Foros del Web. Hi acabo de terminar un codigo donde subo una noticia y al mismo tiempo genero un archivo rss para el feed. Pero ahora quisiera en ...
  #1 (permalink)  
Antiguo 16/06/2009, 13:43
Avatar de GXT2  
Fecha de Ingreso: junio-2009
Ubicación: Fort Lauderdale, FL
Mensajes: 152
Antigüedad: 14 años, 10 meses
Puntos: 0
De acuerdo PHP Ping

Hi acabo de terminar un codigo
donde subo una noticia y al mismo tiempo
genero un archivo rss para el feed. Pero
ahora quisiera en el presiso momento
que subo la noticia y genero el RSS ,
hacer un PING a las paginas para uqe cojan
mi documento rss y lo comience a indexar
a los buscadores.

De antemano quedo agradecido
  #2 (permalink)  
Antiguo 16/06/2009, 13:46
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
verifica sobre system()

Yo tengo este codigo verifica si te es útil

Form
Código PHP:
<form name=form method=post action='<?= $_SERVER['PHP_SELF'?>'>
    <input type=radio name=whatType value='Ping' id='rd_1' <?= ($whatType == 'Ping''checked':'')?>> <label for="rd_1">Ping Host</label> <br>
    <input type=text name=host size=30><br>
    <input type=Submit name=Submit value=Submit class='buttons'>
</form>
Codigo

Código PHP:
if($whatType == 'Ping'){
    
//  This script was writen by [email protected], Dec. 2003
    //  http://www.theworldsend.net 
    //  This is my first script. Enjoy.
    //  
    // Put it into whatever directory and call it. That's all.
    // Updated to 4.2 code 
    // Get Variable from form via register globals on/off
    // Security problem, $count wasn't checked upon. 
    // "-" was zapped out....not anymore
    //-------------------------
    
$max_count 10//maximum count for ping command
    
$unix      =  0//set this to 1 if you are on a *unix system      
    
$windows   =  1//set this to 1 if you are on a windows system
    // -------------------------
    // nothing more to be done.
    // -------------------------
    //globals on or off ?
    
$register_globals = (bool) ini_get('register_gobals');
    
$system ini_get('system');
    
$unix = (bool) $unix;
    
$win  = (bool) $windows;
    
//
    
if ($register_globals){
       
$ip getenv(REMOTE_ADDR);
       
$self $PHP_SELF;
    } 
    else{
       
$ip     $_SERVER['REMOTE_ADDR'];
       
$self   $_SERVER['PHP_SELF'];
    }
    
// form submitted ?
    
if ($whatType == "Ping"){
        
$count 1;
        
// over count ?
        
if ($count $max_count){
            echo 
'Maximum for count is: '.$max_count;
            echo 
'<a href="'.$self.'">Back</a>';
        }
        else{
            
// replace bad chars
            
$hostpreg_replace ("/[^A-Za-z0-9.-]/","",$host);
            
$countpreg_replace ("/[^0-9]/","",$count);
            echo 
"<div align=left class='notifyTitleRegularTables'>
                <b>Ping Output:</b>
            </div>"
;
            echo 
'<pre>';           
            
//check target IP or domain
            
if ($unix){
                
system ("ping -c$count -w$count $host");
                
system("killall ping");// kill all ping processes in case there are some stalled ones or use echo 'ping' to execute ping without shell
            
}
            else{
                
system("ping -n $count $host");
            }
            echo 
'</pre>';
        }
    }


Última edición por GatorV; 16/06/2009 a las 14:29
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:59.