PHP Classes

File: example_simplechat.php

Recommend this page to a friend!
  Classes of Protung Dragos   PHP Yahoo Messenger Archive Decoder   example_simplechat.php   Download  
File: example_simplechat.php
Role: Example script
Content type: text/plain
Description: Example for normal chat
Class: PHP Yahoo Messenger Archive Decoder
Parse Yahoo messenger chat history files
Author: By
Last change:
Date: 14 years ago
Size: 1,488 bytes
 

Contents

Class file image Download
<?php

// Include the class
require_once("YahooMessengerArchiveDecoder.class.php");

// Instantiate the object
$ymad = new YahooMessengerArchiveDecoder();

// Load the archive
// It can have any name, does not need to have the original name
// As phpclasses.org does not allow to upload binary data you must test it with your own archive
// Do not forget to change the name and the rest of the parameters
$ymad->setDatFile("20090908-dragos_protung.dat");

// Set the yahoo messenger ID of the owner of the archive (to what ID does the archive belong to ?)
$ymad->setUserId("dragos_protung"); // yeah, this is my messenger ID :)

// Set a name or alias of the owner of the archive
// This will be used as the name to be displayed instead of the ID when fetching the messages
// The Yahoo Messenger ID is still mandatory
$ymad->setUserName("Dragos");

// Set the name of the chat buddy
// The archive does not store this so you have to put a name
// If no name is entered "buddy" will be used
$ymad->setBuddyName("Tsubaki");

// Decode the archive
// This method also returns the messages
$ymad->decode();
// If the parameter is set to "false", then the format (font size, color, etc) will NOT be stripped
//$ymad->decode(false);

// Just print out the messages, or do anything you want with them :)
foreach ($ymad->getMessages() as $message) {
    print
$message["sentBy"]." (".$message["timestamp"]."): ".$message["message"]."\n";
    print
"<hr/>";
}

?>