yahoo messenger online status php script

Let us talk about scripts, HTML, Perl, PHP, apache, etc.
Post Reply
User avatar
Stevyn
SysOp
Posts:1776
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:
yahoo messenger online status php script

Post by Stevyn » Sat Aug 21, 2010 5:22 am

Code: Select all

Yahoo Online,Offline status

By : sanchir

<?php
// www.webmn.net
function yahoo($id){
$url = 'http://opi.yahoo.com/online?u=';
$data = file_get_contents($url . $id);
if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
return (strlen($data) == 140) ? 'online' : 'offline';
} else {
return trim(strip_tags($data));
}
}
?> 

Contact me directly: Ironfeatherbooks (@) gmail.com

Image

User avatar
Stevyn
SysOp
Posts:1776
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:

Re: yahoo messenger online status php script

Post by Stevyn » Fri Sep 28, 2012 4:47 am

http://blog.ilmuit.com/zainal/2011/06/2 ... using-php/

Code: Select all




function ym($id){
$url = 'http://opi.yahoo.com/online?u=';
$data = file_get_contents($url . $id);
if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
return (strlen($data) == 140) ? 'online' : ‘offline’;
} else {
return trim(strip_tags($data));
}
}
To use the class, just echo your yahoo id by using this code:

Code: Select all


echo ym("yahoo_id"); //change your yahoo id here
Contact me directly: Ironfeatherbooks (@) gmail.com

Image

User avatar
Stevyn
SysOp
Posts:1776
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:

Re: yahoo messenger online status php script

Post by Stevyn » Fri Sep 28, 2012 5:04 am

fancy:

Code: Select all

<?php
/*
*    This script was writed by Setec Astronomy - setec@freemail.it
*
*    This script is distributed  under the GPL License
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*     GNU General Public License for more details.
*
*    http://www.gnu.org/licenses/gpl.txt
*
*/
?>
<html>
<head>
<title>CIMStatus Class Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="" method="get" name="CIMStatus">
  Medium :
  <select name="medium" size="1">
    <option value="aim">AIM</option>
    <option value="icq">ICQ</option>
    <option value="jabber">Jabber</option> 
    <option value="msn">MSN</option>
    <option value="yahoo">Yahoo</option>
  </select>
  <br />
  Account 
  <input name="account" type="text" value="<?php if (isset ($_GET["account"])) { print ($_GET["account"]); }?>">
  <input name="submit" type="submit" value="Query">
</form>
<?php 
include ("CIMStatus.php");

if (isset ($_GET["account"]) && isset ($_GET["medium"]))
{
    $imstatus = new CIMStatus ($_GET["account"], $_GET["medium"]);
    $status = $imstatus->execute ($errno, $errstr);
    if ($status)
    {
        switch ($status) { 
            case IM_ONLINE: 
                print (ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is online!");
                break; 
            case IM_OFFLINE: 
                print (ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is offline!");
                break; 
            case IM_UNKNOWN: 
                print (ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is in an unknown status!");
                break; 
        }         
    }
    else // if ($status)
    {
        print ("An error occurred during CIMStatus query: <br />");
        print ("Error n. " . $errno . ": " . $errstr);
    }
}
?>
</body>
</html> 



Contact me directly: Ironfeatherbooks (@) gmail.com

Image

User avatar
Stevyn
SysOp
Posts:1776
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:

Re: yahoo messenger online status php script

Post by Stevyn » Fri Sep 28, 2012 5:06 am

Code: Select all

 <?php 
/*
*    This script was writed by Setec Astronomy - setec@freemail.it
*
*    This class allows to check the online status of an IM account.    
*    It connects to one of the many onlinestatus servers and request
*    the IM status
*
*    This script is distributed  under the GPL License
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*     GNU General Public License for more details.
*
*    http://www.gnu.org/licenses/gpl.txt
*
*/
define ("IM_ONLINE", 1);
define ("IM_OFFLINE", 2);
define ("IM_UNKNOWN", 3);

define ("IM_ICQ", "icq");
define ("IM_AIM", "aim");
define ("IM_JABBER", "jabber");
define ("IM_MSN", "msn");
define ("IM_YAHOO", "yahoo");

// Configuration section //
$GLOBALS["IM_SERVERS"][] = "http://www.the-server.net:8000/";
$GLOBALS["IM_SERVERS"][] = "http://www.the-server.net:8000/";
$GLOBALS["IM_SERVERS"][] = "http://www.the-server.net:8001/";
$GLOBALS["IM_SERVERS"][] = "http://www.the-server.net:8002/";
$GLOBALS["IM_SERVERS"][] = "http://www.the-server.net:8003/";
/*
$GLOBALS["IM_SERVERS"][] = "http://turdinc.kicks-ass.net:6969/";
$GLOBALS["IM_SERVERS"][] = "http://status.galaxyradioaustria.com:8080/";
$GLOBALS["IM_SERVERS"][] = "http://osi.hshh.org:8088/";
$GLOBALS["IM_SERVERS"][] = "http://snind.gotdns.com:8080/";
$GLOBALS["IM_SERVERS"][] = "http://www.eliott-ness.com:2324/";
$GLOBALS["IM_SERVERS"][] = "http://mightymichelob.tcworks.net:8080/";
$GLOBALS["IM_SERVERS"][] = "http://www.electrocity.ca:81/";
$GLOBALS["IM_SERVERS"][] = "http://4.11.204.17/";
$GLOBALS["IM_SERVERS"][] = "http://www.nextstepcomputers.ath.cx:8080/";
*/
// End configuration section //

class CIMStatus
{
    var $timeout = 20;
    var $medium;
    var $account = "";
        
    function CIMStatus ($account = "", $medium = IM_ICQ)
    {
        $this->medium = $medium;
        $this->account = $account;
    }

    // Begin private functions //
    function _safe_set (&$var_true, $var_false = "")
    {
        if (!isset ($var_true)) 
        { $var_true = $var_false; }
    }
    // End private functions //
    
    function execute (&$errno, &$errstr)
    {
        $errno = ""; 
        $errstr = "";
        $raw_headers = "";
        
        if (empty ($this->account))
        { 
            $errno = "-1"; 
            $errstr = "Account ID not specified!";
            return false;
        }
        
        srand((float) microtime() * 10000000); 
        $server = $GLOBALS["IM_SERVERS"][array_rand ($GLOBALS["IM_SERVERS"])];
        $url = parse_url ($server);
        $this->_safe_set ($url["host"], "localhost");
        $this->_safe_set ($url["port"], "80");
        $this->_safe_set ($url["path"], "/");
        
        $url["path"] = trim ($url["path"]);
        if (substr ($url["path"], -1) != "/")
        { $url["path"] .= "/"; }
        
        $url["path"] .= $this->medium . "/" . $this->account . "/onurl=online/offurl=offline";
        
        if (!function_exists ("fsockopen"))
        {
            $errno = "-1"; 
            $errstr = "Function fsockopen not founded!";
            return false;
        }
        else
        {
            $fp = fsockopen ($url["host"], $url["port"], $errno, $errstr, $this->timeout); 
            if (!$fp) 
            { return false; } 
            else 
            { 
                fputs ($fp,"GET " . $url["path"] . " HTTP/1.1\r\n"); 
                fputs ($fp,"HOST: " . $url["host"] . ":" . $url["port"] . "\r\n"); 
                fputs ($fp,"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"); 
                fputs ($fp,"Connection: close\r\n\r\n"); 
            
                while (!feof ($fp)) 
                { $raw_headers .= fgets ($fp, 128);  }
            } 
            fclose ($fp);
            
            $headers = array ();
            $tmp_headers = explode ("\n", $raw_headers);

            foreach ($tmp_headers as $header)
            { 
                $tokens = explode (":", $header, 2);
                if (isset ($tokens[0]) && (trim($tokens[0]) != ""))
                { 
                    if (!isset ($tokens[1])) { $tokens[1] = ""; }
                    $headers[] = array ($tokens[0] => trim($tokens[1])); 
                }
            }
            
            $location = "";
            foreach ($headers as $header)
            { 
                if (isset ($header["Location"]))
                { 
                    $location = $header["Location"]; 
                    break;
                }
            }

             $parse_location = parse_url ($location);
            $this->_safe_set ($parse_location["host"], "unknown");
            switch ($parse_location["host"]) { 
                case "online": 
                    return IM_ONLINE;        
                    break; 
                case "offline": 
                    return IM_OFFLINE;
                    break; 
                default: 
                    return IM_UNKNOWN;
                    break; 
            }     
        }
    }
}
?> 



Contact me directly: Ironfeatherbooks (@) gmail.com

Image

User avatar
Stevyn
SysOp
Posts:1776
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:

Re: yahoo messenger online status php script

Post by Stevyn » Wed Feb 13, 2013 5:33 am

hi, i have written a php script to list yahoo ids that are online, its slow but works, drop me a line if interested
Contact me directly: Ironfeatherbooks (@) gmail.com

Image

Post Reply