系統環境
作業系統:CentOS 5.2
PHP 版本:PHP 5.1.6 (cli)
Apache 版本:Apache/2.2.3
系統需求
PHP 模組:curl, pcre, mhash, mcrypt, bcmath
至少兩組 MSN 帳號作傳訊測試
// 檢查 PHP 現有模組
#> php -m | grep -E "curl|pcre|mhash|mcrypt|bcmath"
// 安裝 PHP 模組
#> yum install php-curl php-pcre php-mhash php-mcrypt php-bcmath
下載及設定主程式
// 因為官方提供的是 7z 壓縮檔,這在 Linux 的預設環境是不能解壓的,所以先從另一部有裝 7z 解壓縮軟體的 Windows電腦下載後解壓,再使用 WinSCP工具將解壓後的所有檔案,上傳到 Linux 主機內。你也可以直接在 Linux 安裝 7z 解壓工具,請自行用 Google 搜尋教學。
*官方下載
// 新增一個發送訊息的 php 檔
#> vi mymsnsend.php
reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)Callstack:
at User:Alang/IT_專案工作/Send_MSN_message_from_command-line_interface
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown.
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptVar expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptCall expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptSequence expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
; MSN('MSNP15', true) 如果正式使用時,可不加上 true,就不會再顯示除錯訊息。
; from_msnid 填入用來發送訊息的 MSN 帳號
; from_msnpass 填入發送訊息的 MSN 密碼
// 發送訊息測試
#>php mymsnsend.php "to_msn_id" "This is test message"
* 支援離線訊息發送,但 ID 需先經過對方認證。
* 以上只是簡單的應用範例,原始檔案有包含更完整的應用方式。