Subversion Repositories php-qbpwcf

Rev

Blame | Last modification | View Log | RSS feed

<?php

#使用命名空間qbpwcf
namespace qbpwcf{

        #匯入外部套件
        include("../allInOneForSOAP.php");

        #提示執行的函數
        echo "<hr>soap::callService=>local=>authenticate::validationCode<p>";

        #/*

        #建立亂數驗證碼
        #涵式說明:
        #呼叫WebService
        #回傳的結果
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["content"],呼叫完WebService所得回傳結果.
        #必填的參數:
        #$conf["servicePhpFile"],字串,提供服務內容的php檔案的完整絕對位置,裏面要有1個名爲 $conf["serviceClassName"] 類別
        $conf["servicePhpFile"]="~qbpwcf/samplePage/phplib/qbpwcf/authenticate-soap.php";
        #$conf["soapMethod"],字串,要呼叫的方法
        $conf["soapMethod"]="validationCode";
        #$conf["argv"],字串陣列,呼叫方法時所要用到的參數內容
        
                #涵式說明:
                #建立以圖片(PNG格式)呈現的驗證碼.
                #回傳的解果:
                #$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
                #$result["error"],錯誤訊息.
                #$result["function"],檔前執行的函數名稱.
                #$result["randNumberWord"],傳驗證碼的內容.
                #$result["imgAddress"],圖片的位置與名稱.
                #必填的參數:
                #$conf["imgAddressAndName"],字串,爲驗證碼圖片儲存的位置與名稱,副檔名程式會自動產生。
                #$conf["imgAddressAndName"]="";
                #可省略的參數:
                #$conf["num"],字串,爲驗證碼的位數,請輸入阿拉伯數字,預設為"8"位數.
                #$conf["num"]="8";
                #$conf["disableImg"],字串,是否要取消驗證碼圖片的輸出,"true"為要取消,預設為"false"為不取消
                #$conf["disableImg"]="false";   
                #function validationCode(&$conf){
        
        $sendedData["imgAddressAndName"]="testCase/authenticateT/code";
        $conf["argv"]=array($sendedData);#呼叫方法時所要用到的參數內容
        #可省略的參數:
        #$conf["ssl"],字串,是否使用ssl,"true"代表要使用;"false"代表不使用,預設爲"false"
        #$conf["ssl"]="false";
        #$conf["serverIp"],字串,服務提供的主機ip位置,預設爲本機"127.0.0.1"
        #$conf["serverIp"]="127.0.0.1";
        #$conf["port"],port通常不用ssl時為80,用ssl時為443.
        #$conf["port"]="8080";
        #參考資料:
        #http://www.cnblogs.com/chance1/archive/2009/04/08/1431949.html
        #http://www.php.net/manual/en/soapclient.soapcall.php
        $validationCodeImg=soap::callService($conf);
        unset($conf);#移除參數避免錯誤
        unset($sendedData);#移除暫存變數

        #如果 SOAP 失敗
        if($validationCodeImg["status"]=="false"){
                
                var_dump($validationCodeImg);
                exit;
                
                }#if end
                
        #如果內部程序失敗
        if($validationCodeImg["content"]["status"]=="false"){
                
                var_dump($validationCodeImg);
                exit;
                
                }#if end

        #將亂數驗證碼圖片儲存成變數
        #涵式說明:
        #呼叫WebService
        #回傳的結果
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["content"],呼叫完WebService所得回傳結果.
        #必填的參數:
        #$conf["servicePhpFile"],字串,提供服務內容的php檔案的完整絕對位置,裏面要有1個名爲 $conf["serviceClassName"] 類別
        $conf["servicePhpFile"]="~qbpwcf/samplePage/phplib/qbpwcf/img-soap.php";
        #$conf["soapMethod"],字串,要呼叫的方法
        $conf["soapMethod"]="data";
        #$conf["argv"],字串陣列,呼叫方法時所要用到的參數內容

                #函數說明:
                #用data:mimeType;base64,imgVar的形式來提供圖片的連結,亦即圖片儲存在變數裡面.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息
                #$result["content"],語法
                #$result["function"],當前執行的函數名稱 
                #必填參數:
                #$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
                #$conf["imgPosition"]="";
                #可省略參數:
                #$conf["alt"],若沒有圖片要用什麼文字顯示。
                #$conf["alt"]="";
                #$conf["class"],圖片要套用的css樣式名稱.
                #$conf["class"]="";
                #$conf["mimeType"],2元碼的內容是什麼,預設為"image/png".
                #$conf["mimeType"]="image/png";
                #$conf["compressType"],2元碼壓縮的方式,預設為"base64".
                #$conf["compressType"]="base64";
                #$conf["delImg"],讀取完圖片檔案後,要移除圖片嗎?"true"代表要移除,"false"代表不要移除,預設為"false".
                #$conf["delImg"]="false";
                #參考資料:
                #將檔案用字串變數儲存起來=>http://php.net/manual/en/function.file-get-contents.php
                #壓縮2元碼=>http://php.net/manual/en/function.base64-encode.php
                #function data(&$conf){
        
        $sendedData["imgPosition"]=$validationCodeImg["content"]["imgAddress"];
        $sendedData["delImg"]="true";
        $conf["argv"]=array($sendedData);
        #可省略的參數:
        #$conf["ssl"],字串,是否使用ssl,"true"代表要使用;"false"代表不使用,預設爲"false"
        #$conf["ssl"]="false";
        #$conf["serverIp"],字串,服務提供的主機ip位置,預設爲本機"127.0.0.1"
        #$conf["serverIp"]="127.0.0.1";
        #$conf["port"],port通常不用ssl時為80,用ssl時為443.
        #$conf["port"]="8080";
        #參考資料:
        #http://www.cnblogs.com/chance1/archive/2009/04/08/1431949.html
        #http://www.php.net/manual/en/soapclient.soapcall.php
        $data=soap::callService($conf);
        unset($conf);#移除參數避免錯誤
        unset($sendedData);#移除暫存變數
        
        #如果 SOAP 失敗
        if($data["status"]=="false"){
                
                var_dump($data);
                exit;
                
                }#if end
                
        #如果內部程序失敗
        if($data["content"]["status"]=="false"){
                
                var_dump($data);
                exit;
                
                }#if end
        
        #debug
        #var_dump($data);
        #exit;
                
        #印出圖片
        echo $data["content"]["content"];
        
        #提示執行的函數
        echo "<hr>soap::callService=>remote=>authenticate::validationCode<p>";

        #/*

        #建立亂數驗證碼
        #涵式說明:
        #呼叫WebService
        #回傳的結果
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["content"],呼叫完WebService所得回傳結果.
        #必填的參數:
        #$conf["servicePhpFile"],字串,提供服務內容的php檔案的完整絕對位置,裏面要有1個名爲 $conf["serviceClassName"] 類別
        $conf["servicePhpFile"]="~qbpwcf/samplePage/phplib/qbpwcf/authenticate-soap.php";
        #$conf["soapMethod"],字串,要呼叫的方法
        $conf["soapMethod"]="validationCode";
        #$conf["argv"],字串陣列,呼叫方法時所要用到的參數內容
        
                #涵式說明:
                #建立以圖片(PNG格式)呈現的驗證碼.
                #回傳的解果:
                #$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
                #$result["error"],錯誤訊息.
                #$result["function"],檔前執行的函數名稱.
                #$result["randNumberWord"],傳驗證碼的內容.
                #$result["imgAddress"],圖片的位置與名稱.
                #必填的參數:
                #$conf["imgAddressAndName"],字串,爲驗證碼圖片儲存的位置與名稱,副檔名程式會自動產生。
                #$conf["imgAddressAndName"]="";
                #可省略的參數:
                #$conf["num"],字串,爲驗證碼的位數,請輸入阿拉伯數字,預設為"8"位數.
                #$conf["num"]="8";
                #$conf["disableImg"],字串,是否要取消驗證碼圖片的輸出,"true"為要取消,預設為"false"為不取消
                #$conf["disableImg"]="false";
        #function validationCode(&$conf){
        
        $sendedData["imgAddressAndName"]="code";
        $conf["argv"]=array($sendedData);#呼叫方法時所要用到的參數內容
        #可省略的參數:
        #$conf["ssl"],字串,是否使用ssl,"true"代表要使用;"false"代表不使用,預設爲"false"
        #$conf["ssl"]="true";
        #$conf["serverIp"],字串,服務提供的主機ip位置,預設爲本機"127.0.0.1"
        $conf["serverIp"]="169.254.4.3";
        #$conf["port"],port通常不用ssl時為80,用ssl時為443.
        #$conf["port"]="1300";
        #參考資料:
        #http://www.cnblogs.com/chance1/archive/2009/04/08/1431949.html
        #http://www.php.net/manual/en/soapclient.soapcall.php
        $validationCodeImg=soap::callService($conf);
        unset($conf);#移除參數避免錯誤
        unset($sendedData);#移除暫存變數

        #如果執行SOAP失敗
        if($validationCodeImg["status"]=="false"){
                
                #debug
                var_dump($validationCodeImg);
                exit;
                
                }#if end

        #如果執行內部程序失敗
        if($validationCodeImg["content"]["status"]=="false"){
                
                #debug
                var_dump($validationCodeImg);
                exit;
                
                }#if end

        #將亂數驗證碼圖片儲存成變數
        #涵式說明:
        #呼叫WebService
        #回傳的結果
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["content"],呼叫完WebService所得回傳結果.
        #必填的參數:
        #$conf["servicePhpFile"],字串,提供服務內容的php檔案的完整絕對位置,裏面要有1個名爲 $conf["serviceClassName"] 類別
        $conf["servicePhpFile"]="~qbpwcf/samplePage/phplib/qbpwcf/img-soap.php";
        #$conf["soapMethod"],字串,要呼叫的方法
        $conf["soapMethod"]="data";
        #$conf["argv"],字串陣列,呼叫方法時所要用到的參數內容

                #函數說明:
                #用data:mimeType;base64,imgVar的形式來提供圖片的連結,亦即圖片儲存在變數裡面.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息
                #$result["content"],語法
                #$result["function"],當前執行的函數名稱 
                #必填參數:
                #$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
                #$conf["imgPosition"]="";
                #可省略參數:
                #$conf["alt"],若沒有圖片要用什麼文字顯示。
                #$conf["alt"]="";
                #$conf["class"],圖片要套用的css樣式名稱.
                #$conf["class"]="";
                #$conf["mimeType"],2元碼的內容是什麼,預設為"image/png".
                #$conf["mimeType"]="image/png";
                #$conf["compressType"],2元碼壓縮的方式,預設為"base64".
                #$conf["compressType"]="base64";
                #$conf["delImg"],讀取完圖片檔案後,要移除圖片嗎?"true"代表要移除,"false"代表不要移除,預設為"false".
                #$conf["delImg"]="false";
                #參考資料:
                #將檔案用字串變數儲存起來=>http://php.net/manual/en/function.file-get-contents.php
                #壓縮2元碼=>http://php.net/manual/en/function.base64-encode.php
                #function data(&$conf){
        
        $sendedData["imgPosition"]=$validationCodeImg["content"]["imgAddress"];
        $sendedData["delImg"]="true";
        $conf["argv"]=array($sendedData);
        #可省略的參數:
        #$conf["ssl"],字串,是否使用ssl,"true"代表要使用;"false"代表不使用,預設爲"false"
        #$conf["ssl"]="false";
        #$conf["serverIp"],字串,服務提供的主機ip位置,預設爲本機"127.0.0.1"
        $conf["serverIp"]="169.254.4.3";
        #$conf["port"],port通常不用ssl時為80,用ssl時為443.
        #$conf["port"]="1300";
        #參考資料:
        #http://www.cnblogs.com/chance1/archive/2009/04/08/1431949.html
        #http://www.php.net/manual/en/soapclient.soapcall.php
        $data=soap::callService($conf);
        unset($conf);#移除參數避免錯誤
        unset($sendedData);#移除暫存變數
        
        #如果 SOAP 失敗
        if($data["status"]=="false"){
                
                var_dump($data);
                exit;
                
                }#if end
                
        #如果內部程序失敗
        if($data["content"]["status"]=="false"){
                
                var_dump($data);
                exit;
                
                }#if end
        
        #debug
        #var_dump($data);
        #exit;
                
        #印出圖片
        echo $data["content"]["content"];
        
        #*/

        }#namespace qbpwcf end

?>