Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  FAQFAQ  RechercherRechercher  S'enregistrerS'enregistrer  Connexion  

Partagez | 
 

 MR T death checker

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
fridgehead
Lapin nain
Lapin nain


Nbr de messages : 22
Carottes : 4062

MessageSujet: MR T death checker   Lun 18 Sep 2006 - 21:50

hey all, i've finally got back into writing nabaztag apps, and my 1st one for a while now is....


MR T Death checker

Set it to run in a cronjob

0 20 * * * php /opt/share/www/mrt.php >/dev/null

and every 20 minutes it queries the Dead people server to see if mr T is still alive, if not it cries and warns you.



Code:


<?
include("nabaztag-inc.php");
$a = file_get_contents("http://www.dpsinfo.com/wap/dps.html", "r");


$options = array();
$options["rightear"] = 4;
$options["leftear"] = 4;
$options["serial"] = "xxxxxxxxxxxxxx";
$options["token"] = "xxxxxxxxxxxxx";

//$x = new XPath();
//$res = $x->importFromString($gb);
$num = array();
preg_match_all('/mr t.*n/i', $a, $src, PREG_SET_ORDER);

if ($src){
        $te =  "Mr T is dead";
        $options["tts"] = $te;
        $a = send_bunny($options);
        echo "mr t is dead".$a;
} else {
        echo  "mr t is alive";
}

?>

if anyone needs the nabaztag-inc.php file then let me know
Revenir en haut Aller en bas
http://getahaircut.johnnysausage.com
Toucool
Nabazteur/trice
avatar

Age : 40
Localisation : 64
Nabaztag : toucool (V1) Soucoupe (V2)
Nbr de messages : 2531
Carottes : 4165

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 9:29

LOL ! This is the dumbest idea i've ever seen Laughing I love it Laughing
Revenir en haut Aller en bas
http://gru.ptitlu.org
nabazland
Karotzeur taquin
avatar

Age : 50
Localisation : Rouen - France
Nabaztag : Caulfield (v2.1)
Nbr de messages : 9770
Carottes : 10559

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 18:46

Yeah ! Great stupid idea... And it works with madonna !

_____________________________


Revenir en haut Aller en bas
http://www.nabzone.com
aerosmiss
Yellow Subadmin
avatar

Age : 49
Localisation : Paris
Nabaztag : Zvi (V1) et Zeev (V2)
Nbr de messages : 10047
Carottes : 4252

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 19:07

Oh???!!! Tell me more, tell me more!!! yellownabzhappy

What do we have to do with this code? Put it on our personnal website?
Revenir en haut Aller en bas
http://aerosmiss.free.fr
nabazland
Karotzeur taquin
avatar

Age : 50
Localisation : Rouen - France
Nabaztag : Caulfield (v2.1)
Nbr de messages : 9770
Carottes : 10559

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 19:10

Citation :
Latest Deaths from Dead People Server
3,296 Entries Served

Charles L. Grant, 9/15
Oriana Fallaci, 9/14
Ann Richards, 9/13
Pat Corley, 9/11
Steve Irwin, 9/4
Bob Mathias, 9/2

Anybody knows them ?

(I cant use this code, i have no cron)

_____________________________


Revenir en haut Aller en bas
http://www.nabzone.com
aerosmiss
Yellow Subadmin
avatar

Age : 49
Localisation : Paris
Nabaztag : Zvi (V1) et Zeev (V2)
Nbr de messages : 10047
Carottes : 4252

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 19:33

You maybe don't have a cron Landry but you certainly have a crown yellownabzwink

(btw, what is a cron?)
Revenir en haut Aller en bas
http://aerosmiss.free.fr
nabazland
Karotzeur taquin
avatar

Age : 50
Localisation : Rouen - France
Nabaztag : Caulfield (v2.1)
Nbr de messages : 9770
Carottes : 10559

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 19:59

The crontab command, found in Unix and Unix-like operating systems, is used to schedule commands to be executed periodically. It reads a series of commands from standard input and collects them into a file also known as a "crontab" which is later read and whose instructions are carried out.
The name is derived from Greek chronos, meaning time.
Generally, the schedules modified by crontab are enacted by a daemon, crond, which runs constantly in the background and checks once a minute to see if any of the scheduled jobs need to be executed. If so, it executes them. These jobs are generally referred to as cron jobs.

_____________________________


Revenir en haut Aller en bas
http://www.nabzone.com
aerosmiss
Yellow Subadmin
avatar

Age : 49
Localisation : Paris
Nabaztag : Zvi (V1) et Zeev (V2)
Nbr de messages : 10047
Carottes : 4252

MessageSujet: Re: MR T death checker   Mar 19 Sep 2006 - 21:24

Ok so you can't use this with IE huh?
Revenir en haut Aller en bas
http://aerosmiss.free.fr
think
Lapin nain
Lapin nain


Nbr de messages : 6
Carottes : 3891

MessageSujet: Re: MR T death checker   Ven 22 Sep 2006 - 17:40

fridgehead a écrit:
if anyone needs the nabaztag-inc.php file then let me know

Can you send me a link to it please?

Thanks
Revenir en haut Aller en bas
fridgehead
Lapin nain
Lapin nain


Nbr de messages : 22
Carottes : 4062

MessageSujet: Re: MR T death checker   Dim 24 Sep 2006 - 17:01

yup, here it is. This one has been modified to work on a machine that doesnt use the CURL libraries, instead it usesthe file_open bits of PHP. most sane webservers have that turned off, but most sane webservers arent small pc's hidden behind rubbish bins Razz

uncomment the //$gb line and recomment the other to use curl instead

Code:

<?
function send_url($url)
{
        $this->content="";
        $ch = curl_init ();
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
        $a = curl_exec ($ch);
        curl_close ($ch);
        return $a;
}

//take an array of options and pass to the nabaztag API
// serial = serial
// token = token
// leftear = left ear pos
// rightear = right ear pos
// tts = speech
function send_bunny($options){
        $url = "http://www.nabaztag.com/vl/FR/api.jsp?";
        $url = $url."sn=".$options["serial"]."&";
        $url = $url."token=".$options["token"]."&";
        if($options["leftear"]){
                $url = $url."posleft=".$options["leftear"]."&";
        }
        if($options["rightear"]){
                $url = $url."posright=".$options["rightear"]."&";
        }
        if($options["ttlive"]){
                $url = $url."ttlive=".$options["ttlive"]."&";
        }
        $sp = str_replace(" ","+",$options["tts"]);
        $url = $url."tts=".$sp;
//      $gb = send_url ($url);
$gb =  file_get_contents($url, "r");

//      return $gb;
}
?>
Revenir en haut Aller en bas
http://getahaircut.johnnysausage.com
Contenu sponsorisé




MessageSujet: Re: MR T death checker   

Revenir en haut Aller en bas
 
MR T death checker
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» MR T death checker
» [ 40k ] Renegade Militia et death korps of krieg
» Jeu de Rôle sur Death Note
» [40k-Death Guard] Les Oubliés du Terminus Est
» Death Smile II 360 - Subtilités???

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: IV. I Don't Speak French! :: Archives :: API & Developments-
Sauter vers: