Login   Register  
PHP Classes
elePHPant
Icontem

File: send_message.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of philongxp  >  YMSG16  >  send_message.php  >  Download  
File: send_message.php
Role: Example script
Content type: text/plain
Description: Small sample login and send message.
Class: YMSG16
YMSG16 send message, deny buddy, status checker
Author: By
Last change: send_message.phpChange port 5050 to 80
Date: 2010-05-11 23:29
Size: 2,045 bytes
 

Contents

Class file image Download
<?php    
    $uid    
"";    // Bot ID
    
$pwd    "";    // Bot Pwd
    
$target    "";    // TargetID
    
    
include 'YMSG.class.php';    // YMSG Protocol Class
    
$ymsg = new YMSG();

    
// Connect to server
    
$server    file_get_contents('http://vcs1.msg.yahoo.com/capacity');
    
$server    substr($serverstrpos($server"CS_IP_ADDRESS=") + strlen("CS_IP_ADDRESS="));
    
$fp fsockopen($server80$errno$errstr2) or die('Cannot connect!!!');    
    if (
$fp != null)
    {
        
stream_set_timeout($fp1); 
    }
    
    
// Create Send IM Packet
    
$sendPM        $ymsg->sendPM($uid$target"Test Message");
        
    
// Create preConnect Packet
    
$preChk $ymsg->preCheck();
    
fwrite($fp$preChk);    
    
    
// Preconnect result
    
$chkStr     fread($fp20);
    
    if (
$ymsg->getPacketType($chkStr) == 'L')
    {
        print 
'Precheck success!!!<br/>';    
        
        
// Create Challenge Request Packet
        
$chkStr $ymsg->getChallenge($uid);
        
fwrite($fp$chkStr);
        
$chlStr fread($fp150);
    }
    
    if (
$ymsg->getPacketType($chkStr) == 'W')
    {
        print 
'Challenge Succes!!!<br/>';
        
        
// Get Status and Challenge String from Server Response
        
$status     $ymsg->parseToken($chlStr"13".$ymsg->sepStrchr(0xC0));
        
$challenge     $ymsg->parseToken($chlStr"94".$ymsg->sepStrchr(0xC0));
        
        
// Get and Parse Login Cookie Info
        
$info        $ymsg->getLoginInfo($uid$pwd$challenge);
        
$crumb        $ymsg->parseToken($info"crumb="chr(0xD));
        
$T            $ymsg->parseToken($info"T="chr(0xD));
        
$Y            $ymsg->parseToken($info"Y="chr(0xD));
        
        
// Create Login Packet
        
$loginStr    $ymsg->Login($uid$challenge$Y$T$crumbtrue);    
        
fwrite($fp$loginStr);
        
        
// Login Result
        
$loginRes    fread($fp1024);
    }
    
    if (
$ymsg->getPacketType($loginRes) == 'U')
    {
        print 
'Login Succes!!!<br/>';    
        
        
// Account info: Friend List, Ignore List, etc...
        
$nextData '';
        do {
            
$nextData fread($fp500);
        } while (
strlen($nextData) > 0);
    }

    
// Login Done
    
print 'Send PM!!!<br/>';    
    
fwrite($fp$sendPM);
    
$result fread($fp1024);
?>