Exemplo n.º 1
0
#!/usr/bin/php -Cq
<?php 
error_reporting(E_ALL);
include_once 'msn.class.php';
// force to use MSNP9, without debug information
// $msn = new MSN('MSNP9');
// force to use MSNP9, with debug information
// $msn = new MSN('MSNP9', true);
// force to use MSNP15, without debug information
// $msn = new MSN('MSNP15');
// force to use MSNP15, with debug information
// $msn = new MSN('MSNP15', true);
// auto detect MSN protocol, without debug information
// $msn = new MSN;
// auto detect MSN protocol, with debug information
$msn = new MSN('', true);
if (!$msn->connect('YOUR_ID', 'YOUR_PASSWORD')) {
    echo "Error for connect to MSN network\n";
    echo "{$msn->error}\n";
    exit;
}
$msn->sendMessage('Now: ' . strftime('%D %T') . "\nTesting\nSecond Line\n\n\n\nand Empty Line", array('*****@*****.**', '*****@*****.**'));
echo "Done!\n";
exit;
?>

Exemplo n.º 2
0
 /**
  * 返回一个数组,该数组的键是联系人的email地址,值是联系人的昵称。
  * 如果获取失败,返回false
  *
  * @param  string $user - 邮箱
  * @param  string $pass - 密码
  */
 public static function get_msn_friends($user, $pass, $proxy_url = '')
 {
     $msn = new MSN('MSNP15', true);
     $msn->proxy = $proxy_url;
     if (!$msn->connect($user, $pass)) {
         return false;
     }
     //获取联系人列表
     $contacts = $msn->getMembershipList();
     return $contacts;
 }