What's new? | Help | Directory | Sign in
Google
mzk
                
Search
for
Updated Jan 30, 2007 by sirdarckcat
Labels: Phase-Implementation
ExampleSession  
Example of basic session connections.

Documentation Index

Example sessions

This function will simply login to the .NET Passport account.. and show the response of the server.

<?php
    include("mzk.php"); 
    $t = new MezzengerKlient; 
    $t->debug=true; 
    $t->init("mail@mail.com","password"); 
    $t->login(); 
    $t->main(); 
    $t->quit(); 
?>

This function will say "Hello" to all contacts online.

<?php
    include("mzk.php"); 
    $t = new MezzengerKlient; 
    $t->debug=true;
	$t->onLogin="spam";
    $t->init("mail@mail.com","password"); 
    $t->login(); 
    $t->main(); 
    $t->quit(); 
	
	function spam(){
		global $t;
		for ($i=0;isset($t->onlinefriends[$i]);$i++){
			$cont=@split(' ',$t->onlinefriends[$i]);
			$t->MessageToNew($cont[0],"Hello");
		}
	}
?>

This function will change the bot's nick to "I am a bot" when logged in.

<?php
    include("mzk.php"); 
    $t = new MezzengerKlient; 
    $t->debug=true;
	$t->onLogin="change_nick";
    $t->init("mail@mail.com","password"); 
    $t->login(); 
    $t->main(); 
    $t->quit(); 
	
	function change_nick(){
		global $t;
		$t->setNick('I am a bot');
	}
?>

More examples can be found at the download section here: http://code.google.com/p/mzk/downloads/list


Comment by theozoeht, Mar 15, 2008

Hello, plz can you help me ? I want to stop the bot after hi say to all "hello" ...

Thank's for all !

Comment by Eleazan, Apr 30, 2008

maybe

<?php

    include("mzk.php"); $t = new MezzengerKlient?; $t->debug=true; 

    $t->onLogin="spam";

        $t->init("mail@mail.com","password"); $t->login(); $t->main(); $t->quit(); 

    function spam(){

        global $t; for ($i=0;isset($t->onlinefriends[$i]);$i++){

            $cont=@split(' ',$t->onlinefriends[$i]); $t->MessageToNew?($cont0?,"Hello"); 

        }

            $t->quit(); 

    } 

?>
Comment by setting7, May 04, 2008

Hola me gustaria saber como realizar el codigo para que cuando el bot reciba el primer mensaje diga un mensaje de alerta y al finalizar la conversacion envie todo el log a un correo electronico, algo asi.

contacto dice: Hola!! bot dice: Hola soy un bot. =)

Y cuando el contacto cierre su ventana de conversacion se envie el log al correo.

alguien puede ayudarme?

Comment by ad...@3jugadores.com, May 19, 2008

Hola. Estoy intentando que cuando hable con todos los contactos el script se desconecte y no se quede cargado el php pero no lo consigo. Intente esto:

global $t; for ($i=0;isset($t->onlinefriends[$i]);$i++){ $cont=@split(' ',$t->onlinefriends[$i]); $t->MessageToNew?($cont0?,"Hello"); } $t->quit(); }

El script se queda detenido pero no envia el mensaje a los usuarios. Tambien intente con die; en vez de $t->quit(); pero ocurre lo mismo!!

Que puedo hacer!?

Comment by vprelovac, Jul 11, 2008

Hi

I am wondering can the class send a add a friend request?

What I want to do is to use the class to send a message to the user. I think this does not work without user first accepting the bot as friend?

Is there an example for doing this?

Comment by pedsters.planet, Aug 20, 2008

If I add a loop after the main() function, how can we monitor for any messages (RNG), then respond to them automatically? Can that be done?

eg. (from a diff php bot)

$data = $this->get();

if ($data) { switch($code = substr($data, 0, 3)) { default: case 'RNG': if (preg_match('/BLEEP(.?)$/i', $msg)) { $sbsess->tx_im($this->fp, "O BLEEP you too!", $this->passport, $email); }

} }

Comment by pedsters.planet, Aug 21, 2008

Also, I'm gertting this Nexus Error.. even though curl & ssl are compiled in PHP.

What does the $matches[] array hold? As I can't see anywhere for it to get anything.. :(

Comment by duas.rpg, Aug 21, 2008

Sería posible dejar el bot conectado las 24h? me gustaría hacer una aplicacion que buscara en mi web (le dices al bot "!busca HOLA" y aparezcan los post que contengan hola, o link a la pagina de busqueda) pero parece que cuando acaba el tiempo de ejecución, deja de funcionar, deja de responder y al tiempo parece que se desconecta. Tiene limite de contactos el bot? habria que usar varias cuentas si lo tiene o que solucion tomar? Gracias!


Sign in to add a comment