note: php發送msn訊息 (php msn class)
2010-08-09 21:00

使用 MSNP15 協定,PHP 要先支援:curl、pcre、mhash、mcrypt、bcmath
bcmath 直接 enable 即可 ( --enable-bcmath )
libmcrypt
http://mcrypt.hellug.gr/lib/index.html (先裝libmcrypt 才能裝 mcrypt)
mcrypt
http://mcrypt.sourceforge.net/
mhash
http://sourceforge.net/projects/mhash/
PHP 重新 compiler
./configure --with-mysql=/usr/local/mysql --with-apxs2=/home/www/httpd2.0.63/bin/apxs \
--with-gd --with-zlib --with-jpeg-dir --with-png-dir --enable-exif --with-freetype-dir \
--with-curl --with-gettext --with-mcrypt --with-mhash --enable-bcmath
PHP MSN Class
下載
http://code.google.com/p/phpmsnclass/
原作者 Tommy Wu http://blog.teatime.com.tw/1/post/200
簡單的範例
#!/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('xxx@hotmail.com', 'msn password')) { //發送人的 MSN帳號、密碼
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(
'somebody1@hotmail.com',
'somebody2@hotmail.com'
)
);
echo "Done!\n";
exit;
?>
[我要留言]


