PHP Classes

File: example_conference.php

Recommend this page to a friend!
  Classes of Protung Dragos   PHP Yahoo Messenger Archive Decoder   example_conference.php   Download  
File: example_conference.php
Role: Example script
Content type: text/plain
Description: Example for conference
Class: PHP Yahoo Messenger Archive Decoder
Parse Yahoo messenger chat history files
Author: By
Last change:
Date: 15 years ago
Size: 1,835 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
// Set the second parameter to "true". This way the class knows that this archive is a conversation
// (chat between multiple users)
$ymad->setDatFile("20090309-dragos_protung.dat", true);

// Set the yahoo messenger ID of the owner of the archive
$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 names of the persons that participated in the chat
// This is not mandatory and as the owner user name is just for cosmetics.
// If nothing is defined then the ID will be taken from the archive
// In conversation archives the ID's of the friends are storred in the archive
$ymad->setConferenceBuddyName("someone_in_chat", "Some person 1");
$ymad->setConferenceBuddyName("another_friend", "My best friend");


// Decode the archive
// This 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 you enything you want with them :)
foreach ($ymad->getMessages() as $message) {
    print
$message["sentBy"]." (".$message["timestamp"]."): ".$message["message"]."\n";
    print
"<hr>";
}

?>