Filehost.ro - gazduire fisiere
HACKSFORUM
Cel mai tare forum romanesc de hacking , gamming , programare si tot ce tine de PC :D!
Nou pe simpatie:
Kitana pe Simpatie.ro
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 48 ani
HACKSFORUMReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
HACKSFORUM / Hacking-ul nostru cel de toate zilele /

[PHP]Yahoo auto-response robot

Pagini: 1  
#1
Emyyy
Administrator
Postari: 45
Poate unii dintre voi ştiţi "Roboţeii de Yahoo" , cu un id genul "pnmrobot" care īţi răspunde la īntrebări şi comenzi, ei bine, puteţi face şi voi unul , şi cel mai uşor este prin PHP şi IMIFIED . Faceţi un cont pe IMified.com, moca , vă logaţi pe cont, creeaţi un ID de messenger, cu care creeaţi un BOT de pe pagina respectivă din IMified . La BotName puneţi un nume pentru robot, BotURL, linkul unde va fii hostat scriptul botului īn PHP, ex : http://exem.plu/bla.php . Apoi la network settings daţi la yahoo şi puneţi datele de la id-ul yahoo creeat . Deocamdată e gata, acum urmează partea mai grea, scriptul in php .
Codul poate fii ceva de genul :
Primu fisier se numeste bot.php continutul lui este:

Code:

<?php
include_once("func.php");

error_reporting(0);


if(!isset($_REQUEST['msg']))
{
    echo "Accesul direct este nepermis";
    die();
}

$im = new ImifiedHelper(" APy Key De pe ImiField"," ","parolabut");
//callback
$im->setCallback("callback"); 
function callback($message, $step, $network, $userKey)
{
    global $im;
    $message = strtolower($message);
  
    if($message=="ajutor")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Comenzi disponibile: <b><red>regulament, parteneriat, host, comanda, creator</red></b>";
        $im->resetStep();
    }
            
        else if($message=="regulament")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Acest but este creat pentru communitate expertcs.info ! Nu aveti voie sa injurati sa flodati!";
        $im->resetStep();
    }
    else if($message=="host")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Ai auzit ceva nou? expertcs.info este reseller GamesZone.ro! Pentru link detalii tasteaza <b><red>comanda</red></b>";
        $im->resetStep();
    }
else if($message=="comanda")
    {
        echo "<b><red>Comanda (*)</red></b> Link comanda: ......";
        $im->resetStep();
    }
    
    else if($message=="ce faci?")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Bine navighez pe Adresa Site . Tu ce faci? :)";
        $im->resetStep();
    }
    else if($message=="bine")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Lasa ca este bine!Scuza-ma dar eu am putina treaba vorbim mai incolo.Salut :-h.";
        $im->resetStep();
    }
    elseif($message=="creator")
    {
        echo " <b><red>[Adresa Site] (*)</red></b> Am fost creat de   <b><red>Stefan</red></b>.";
        $im->resetStep();
    }
         elseif($message=="Stefan" ||$message=="stefan"  )
    {
        echo " <b><red>Stefan (*)</red></b> este detinator Adresa site ";
        $im->resetStep();
    }
    elseif($message=="salut")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Salut si tie ! O zi buna !";
        $im->resetStep();
    }
        elseif($message=="parteneriat")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Parteneriat cu expertcs.info faci aici http://forum.expertcs.info/viewforum.php?f=15";
        $im->resetStep();
    }

         elseif($message=="sugi pula")
    {
        echo "<b><red>[Adresa Site] (*)</red></b> Esti prost cu diploma! Sunt eu but dar stiu ce zici!"; 
        $im->resetStep();
    }
        
        elseif($message=="mass")
    {
        echo "<b><red>[Adresa Site]</red></b> Mai usor cu mass-urile"; 
        $im->resetStep();
    }
        elseif($message=="pula" || $message=="plm" || $message=="sms" || $message=="f.m.m" || $message=="fmm")
    {
        echo "<b><red>[Adresa Site] (*)</red></b><blue> Esti prost cu diploma! Sunt eu but dar stiu ce zici!</blue>"; 
        $im->resetStep();
    }
       
        elseif($message=="flood")
    {
        echo "<b><red>[Adresa Site]  (*)</red></b> Pleaca ma prostule de aici ca nai tu cum sa-mi dai mie flood"; 
        $im->resetStep();
    }
        
          elseif($message=="smecher")
    {
        echo "<b><red>[Adresa Site]  (*)</red></b> De 2 ori prost si 1 odata fraer 3 in 1 = Un prost cu cap pe umeri "; 
        $im->resetStep();
    }
  
            elseif($message=="numar")
    {
        echo "<b><red>[Adresa Site]  (*)</red></b> Numarul meu este 112 intoarcete inapoi!"; 
        $im->resetStep();
    }
    else
    {
    echo "<b><red>[Adresa Site]  (*)</red></b> Aceasta comanda nu este disponibila. Te rog tasteaza <b><red>ajutor</red></b> pentru mai multe comenzi";
    }
    $im->resetStep();
    }
?>

Dupa asta va trebuie func.php :

Code:

<?php
/**
 * wrapper of imified (http://bot.im) API to ease bot development process
 * @author Hasin Hayder [http://hasin.wordpress.com]
 * @copyright BSD Licence
 * @example check out example.php
 * @link http://hasin.wordpress.com
 * @
 *
 */
class ImifiedHelper
{
    public $botkey;
    public $botownername;
    public $botownerpwd;

    function __construct($botkey, $botownername="",$botownerpwd = "")
    {
        $this->botkey= $botkey;
        $this->botownername = $botownername;
        $this->botownerpwd = $botownerpwd;
    }

    /**
     * get information of a specific bot user using their corresponding user key
     *
     * @param string $userKey
     */
    function getUserInfo($userKey)
    {
        if(!isset($this->botkey))
        throw new Exception("You must supply your bot key to use this function [getUserInfo]");
        else if(!isset($this->botownername))
        throw new Exception("You must supply your bot account user name to use this function [getUserInfo]");
        else if(!isset($this->botownerpwd))
        throw new Exception("You must supply your bot account password to use this function [getUserInfo]");
        
        if(!isset($userKey))
        throw new Exception("You must supply a user to find info");

        $url = 'http://www.imified.com/api/bot/';
        $data = array(
        'botkey' => $this->botkey,
        'apimethod' => 'getuser',
        'userkey' => $userKey,
        );

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_USERPWD, "{$this->botownername}:{$this->botownerpwd}");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 100);
        $xmlResponse = curl_exec($ch);
        curl_close($ch);

        $sxml = simplexml_load_string($xmlResponse);
        if($sxml['stat']=="ok")
        {
            $userInfo = array();
            $userInfo['status']=$sxml->user->status."";
            $userInfo['userkey']=$userKey."";
            $userInfo['screenname']=$sxml->user->screenname."";
            $userInfo['network']=$sxml->user->network."";
            $userInfo['created']=$sxml->user->created."";
            $userInfo['lastonline']=$sxml->user->lastonline."";
            $userInfo['lastcall']=$sxml->user->lastcall."";

            return $userInfo;

        }
        else if($sxml['stat']=="fail"){
            //error, so throw an exeption
            $errorMessage = $sxml->err['msg']."";
            throw new Exception($errorMessage);
        }
    }

    /**
     * send an instant message to a group of user[s]
     *
     * @param array $userKey
     */
    function sendMessage($message, $userKeys)
    {
        if(!isset($this->botkey))
        throw new Exception("You must supply your bot key to use this function [getUserInfo]");
        else if(!isset($this->botownername))
        throw new Exception("You must supply your bot account user name to use this function [getUserInfo]");
        else if(!isset($this->botownerpwd))
        throw new Exception("You must supply your bot account password to use this function [getUserInfo]");

        if(!isset($userKeys))
        throw new Exception("You must supply a user or an array of users as recepient of your IM");

        if(!isset($message))
        throw new Exception("Message couldn't be blank");
        
        echo "sending";

        if(!is_array($userKeys))
        $users = $userKeys;
        else
        $users = join(",",$userKeys);

        $url = 'http://www.imified.com/api/bot/';
        $data = array(
        'botkey' => $this->botkey,
        'apimethod' => 'send',
        'userkey' => $users,
        'msg' => $message,

        );

        try{
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_USERPWD, "{$this->botownername}:{$this->botownerpwd}");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 100);
        $xmlResponse = curl_exec($ch);
        print_r($xmlResponse);
        curl_close($ch);
        }
        catch(Exception $e)
        {
            print_r($e);
        }

        $sxml = simplexml_load_string($xmlResponse);
        print_r($sxml);
        if($sxml['stat']=="ok")
        {
            return true;
        }
        else if($sxml['stat']=="fail"){
            //error, so throw an exeption
            $errorMessage = $sxml->err['msg']."";
            throw new Exception($errorMessage);
        }
    }
    
    /**
     * reset the step variable;
     *
     */
    function resetStep($stepId="")
    {
        if(!isset($stepId))
        echo "<reset>";
        else 
        echo "<goto step={$stepId}>";
    }
    
    /**
     * for easier processing, use setCallback to invoke a function with four parameters - message, stepId, network,userKey
     *
     * @param unknown_type $callback
     * @example a callback function must be of this format function cb($messsage,$stepId, $network, $userKey){}
     */
    function setCallback($callback)
    {
        if(!isset($callback))
        throw new Exception("callback couldn't be blank");

        $message = $_REQUEST['msg'];
        $step = $_REQUEST['step'];
        $network = $_REQUEST['network'];
        $userKey = $_REQUEST['userkey'];
        $callback($message,$step,$network,$userKey);
    }

}

?>

Acesta este doar un exemplu, dacă ştiţi şi puţin php probabil vă veţi da seama ce face . Puteţi face muuulte chestii , de la răspuns cu cursul valutar aferent pānă la logare pe site-ul dumneavoastră de pe messenger şi afişarea unor chestii din baza de date . Baftă !


 
   
Pagini: 1  
Mergi la