Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/10/2011, 21:15
dleal100
 
Fecha de Ingreso: septiembre-2011
Mensajes: 158
Antigüedad: 12 años, 7 meses
Puntos: 15
Respuesta: fsockopen en js

para eso necesitas ajax :)

ESTE ARCHIVO LO GUARDAS COMO SETE DE LA GANA xd
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>titulo</title>
<script type="text/javascript">
function lacaca(){
if(window.XMLHttpRequest)
{var yo= new XMLHttpRequest();}
else{var yo= new ActiveXObject("Microsoft.XMLHTTP");}

yo.onreadystatechange=function(){
////

if(yo.readyState==4 && yo.status==200)
{
document.getElementById("caca").innerHTML=yo.responseText;
}
else{document.getElementById("caca").innerHTML="Cargando...";}//mensaje cargando :3
/////
}
yo.open("GET","o.php?estado=si", true);
yo.send();
//
}
</script>
</head>
<style type="text/css">
#caca{background-color:#CCC;
margin:20% auto;
width:500px;
padding:10px 10px 10px 10px;
cursor:pointer;
}
</style>
<body>
<div id='caca' onclick='lacaca();'>click aca para saver el estado del servidor</div>

</body>
</html>
ESTE OTRO ARCHIVO LO YAMAS COMO "o.php" <--- sin las comillas XD
Código:
<?php
if($_GET["estado"]=="si")
{

//////////ACA TU CODIGO PHP, le puse un echo para que vieras como funciona
echo "el estado es bueno XD";

}
?>