Rev 226 | Rev 253 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*QBPWCF, Quick Build PHP website Component base on Fedora Linux.Copyright (C) 2014~2026 MIN ZHI, CHENThis file is part of QBPWCF.QBPWCF is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.QBPWCF is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with QBPWCF. If not, see <http://www.gnu.org/licenses/>.*/namespace qbpwcf;/*類別說明:應用 zerossl 的類別.備註:無.*/class zerossl{/*#函式說明:#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#必填參數:#$method,物件,為物件實體或類別名稱,會自動置入該參數.#$arguments,陣列,為呼叫方法時所用的參數.#參考資料:#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic#備註:#無.*/public function __call($method,$arguments){#取得當前執行的函式$result["function"]=__FUNCTION__;#設置執行不正常$result["status"]="false";#設置執行錯誤$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";#設置所丟入的參數$result["error"][]=$arguments;#回傳結果return $result;}#function __call end/*#函式說明:#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#必填參數:#$method,物件,為物件實體或類別名稱,會自動置入該參數.#$arguments,陣列,為呼叫方法時所用的參數.#參考資料:#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic#備註:#無.*/public static function __callStatic($method,$arguments){#取得當前執行的函式$result["function"]=__FUNCTION__;#設置執行不正常$result["status"]="false";#設置執行錯誤$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";#設置所丟入的參數$result["error"][]=$arguments;#回傳結果return $result;}#function __callStatic end/*#函式說明:#取得api的資訊#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#$result["content"],api資訊陣列.#必填參數:#無#可省略參數:#無#參考資料:#無.#備註:#無.*/public static function getApiInfo(){#初始化要回傳的陣列$result=array();#api domain$result["apiDomain"]="api.zerossl.com";#create certificate path$result["csrPath"]="/certificates";#create certificate url$result["csrUrl"]=$result["apiDomain"].$result["csrPath"];#api access key$result["apiKey"]=zeroSSLapiKey;#設置執行正常$result["status"]="true";#回傳結果return $result;}#function getApiInfo end/*#函式說明:#產生ssl private key.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#$result["argu"],所使用的參數.#$result["curl_verbose_info"],curl執行的詳細資訊.#必填參數:#$conf["fileArgu"],字串,變數__FILE__的內容.$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["length"],整數,金鑰的長度,預設為 4096(bit).#$conf["length"]=4096';#參考資料:#無.#備註:#key generated by openssl with RSA.*/public static function createPrivateKey(&$conf){#初始化要回傳的結果$result=array();#取得當前執行的函數名稱$result["function"]=__FUNCTION__;#如果 $conf 不為陣列if(gettype($conf)!="array"){#設置執行失敗$result["status"]="false";#設置執行錯誤訊息$result["error"][]="\$conf變數須為陣列形態";#如果傳入的參數為 nullif($conf==null){#設置執行錯誤訊息$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";}#if end#回傳結果return $result;}#if end#取得參數$result["argu"]=$conf;#函式說明:#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],執行不正常結束的錯訊息陣列.#$result["simpleError"],簡單表示的錯誤訊息.#$result["function"],當前執行的函式名稱.#$result["argu"],設置給予的參數.#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.#$result["argu"],字串陣列,目前輸入的參數名稱陣列.#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.#$result["notNeedVar"],字串陣列,多餘的參數名稱.#必填參數:#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。$conf["variableCheck::checkArguments"]["varInput"]=&$conf;#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";#可省略參數:#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu");#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.#$conf["canNotBeEmpty"]=array();#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.#$conf["canBeEmpty"]=array();#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("length");#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("length");#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("integer");#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(4096);#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".#$conf["disallowAllSkipableVarIsEmpty"]="";#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".#$conf["disallowAllSkipableVarIsEmptyArray"]="";#$conf["disallowAllSkipableVarNotExist"],字串,是否不允許每個可省略參數都不存在,預設為"false"代表允許,反之為"true".#$conf["disallowAllSkipableVarNotExist"]="";#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.#$conf["arrayCountEqualCheck"][]=array();#參考資料:#array_keys=>http://php.net/manual/en/function.array-keys.php#備註:#無.$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);unset($conf["variableCheck::checkArguments"]);#如果 $checkArguments["status"]等於 "false"if($checkArguments["status"]==="false"){#設置執行錯誤的識別$result["status"]="false";#設置錯誤訊息$result["error"]=$checkArguments;#回傳結果return $result;}#if end#如果 $checkArguments["passed"]等於 "false"if($checkArguments["passed"]==="false"){#設置執行錯誤的識別$result["status"]="false";#設置錯誤訊息$result["error"]=$checkArguments;#回傳結果return $result;}#if end#函式說明:#呼叫shell執行系統命令,並取得回傳的內容.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息陣列.#$result["function"],當前執行的函數名稱.#$result["argu"],使用的參數.#$result["cmd"],執行的指令內容.#$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.#$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.#$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.#$result["running"],是否還在執行.#$result["pid"],pid.#$result["statusCode"],執行結束後的代碼.#$result["escape"],陣列,儲存重新排序過且已經escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").#必填參數:#$conf["command"],字串,要執行的指令.$conf["external::callShell"]["command"]="openssl";#$conf["fileArgu"],字串,變數__FILE__的內容.$conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];#可省略參數:#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.$conf["external::callShell"]["argu"]=array("genrsa",$conf["length"]);#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").#$conf["arguIsAddr"]=array();#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".#$conf["enablePrintDescription"]="true";#$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.#$conf["printDescription"]="";#$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.$conf["external::callShell"]["escapeshellarg"]="true";#$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.#$conf["thereIsShellVar"]=array();#$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.#$conf["username"]="";#$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.#$conf["password"]="";#$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".#$conf["useScript"]="";#$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".#$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";#$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.#$conf["inBackGround"]="";#$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.#$conf["getErr"]="false";#$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.#$conf["doNotRun"]="false";#參考資料:#exec=>http://php.net/manual/en/function.exec.php#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php#備註:#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.#若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.$callShell=external::callShell($conf["external::callShell"]);unset($conf["external::callShell"]);#如果異常if($callShell["status"]==="false"){#設置錯誤識別$result["status"]="false";#設置錯誤訊息$result["error"]=$callShell;#回傳結果return $result;}#if end#函式說明:#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".#回傳的結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的function名稱#$result["error"],錯誤訊息陣列.#$result["content"],處理好的字串.#$result["argu"],使用的參數.#必填參數:#$conf["inputArray"],字串陣列,要轉成字串的一維陣列.$conf["arrays::arrayToString"]["inputArray"]=$callShell["output"];#可省略參數:#$conf["spiltSymbol"],字串,用來區隔字串的符號,預設為;$conf["arrays::arrayToString"]["spiltSymbol"]="";#$conf["skipEnd"],字串,結尾是否不要加上符號,預設為"false",要加上符號,"true"代表不要加上符號。$conf["arrays::arrayToString"]["skipEnd"]="true";#$conf["spiltSymbolAtStart"],字串,是否要在開頭加上spiltSymbol,預設為"false",代表不要;反之為“true”.#$conf["spiltSymbolAtStart"]="";#參考資料:#無.#備註:#無.$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);unset($conf["arrays::arrayToString"]);#如果異常if($arrayToString["status"]==="false"){#設置錯誤識別$result["status"]="false";#設置錯誤訊息$result["error"]=$arrayToString;#回傳結果return $result;}#if end#取得 private key 字串$result["content"]=$arrayToString["content"];#設置執行正常$result["status"]="true";#回傳結果return $result;}#function createPrivateKey end/*#函式說明:#產生certificate sign request.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#$result["argu"],所使用的參數.#$result["curl_verbose_info"],curl執行的詳細資訊.#必填參數:#$conf["certificate_domains"],字串,要簽署的doamin名稱.$conf["certificate_domains"]="";#$conf["certificate_csr"],字串,簽署的資訊.$conf["certificate_csr"]="";#$conf["fileArgu"],字串,變數__FILE__的內容.$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["apiDomain"],字串,提供服務的domain,預設為 self::getApiInfo()["doamin"].#$conf["apiDomain"]=self::getApiInfo()["doamin"];#$conf["path"],字串,提供服務的path,預設為 self::getApiInfo()["csrPath"].#$conf["path"]=self::getApiInfo()["csrPath"];#$conf["key"],字串,api key,預設為 self::getApiInfo()["apiKey"].#$conf["key"]=self::getApiInfo()["apiKey"];#參考資料:#無.#備註:#無.*/public static function csr(&$conf){#break point#var_dump(self::getApiInfo());exit;#初始化要回傳的結果$result=array();#設置當其函數名稱$result["function"]=__FUNCTION__;#如果 $conf 不為陣列if(gettype($conf)!="array"){#設置執行失敗$result["status"]="false";#設置執行錯誤訊息$result["error"][]="\$conf變數須為陣列形態";#如果傳入的參數為 nullif($conf==null){#設置執行錯誤訊息$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";}#if end#回傳結果return $result;}#if end#取得參數$result["argu"]=$conf;#檢查參數#函式說明:#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$reuslt["error"],執行不正常結束的錯訊息陣列.#$result["function"],當前執行的函式名稱.#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.#$result["argu"],字串陣列,目前輸入的參數名稱陣列.#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.#$result["notNeedVar"],字串陣列,多餘的參數名稱.#必填寫的參數:#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。$conf["variableCheck::checkArguments"]["varInput"]=&$conf;#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","certificate_domains","certificate_csr");#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object");$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";#可以省略的參數:#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.#$conf["skipableVariableCanNotBeEmpty"]=array();#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("apiDomain","path","key");#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(self::getApiInfo()["apiDomain"],self::getApiInfo()["csrPath"],self::getApiInfo()["apiKey"]);#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.#$conf["arrayCountEqualCheck"][]=array();#參考資料來源:#array_keys=>http://php.net/manual/en/function.array-keys.php$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);unset($conf["variableCheck::checkArguments"]);#如果檢查失敗if($checkArguments["status"]=="false"){#設置錯誤識別$result["status"]="false";#設置錯誤訊息$result["error"]=$checkArguments;#回傳結果return $result;}#if end#如果檢查不通過if($checkArguments["passed"]=="false"){#設置錯誤識別$result["status"]="false";#設置錯誤訊息$result["error"]=$checkArguments;#回傳結果return $result;}#if end#要傳送的 key -> value$postArray=array();#設置要簽署的domain$postArray["certificate_domains"]=$conf["certificate_domains"];#設置csr$postArray["certificate_csr"]=$conf["certificate_csr"];#預設為 90 天的憑證$postArray["certificate_validity_days"]=90;#強制讓 要簽署的domain 為 $postArray["certificate_domains"]$postArray["strict_domains"]=1;#設置要傳送的 json$postJson=json_encode($postArray);#函式說明:#運行curl cmd#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息陣列.#$result["function"],當前執行的函式名稱.#$result["founded"],識別網址找不找得到.#$result["content"],取得的回應內容陣列;若$conf["bgInProc"]為"true",則每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.#$result["fullContent"],取得回應的完整字串內容.#$result["cookie"],cookie檔案的位置與名稱.#$result["cmd"],執行的command.#$result["argu],使用的參數.#必填參數:#$conf["url"],字串,目標url.$conf["catchWebContent::curlCmd"]["url"]="https://".$conf["apiDomain"].$conf["path"]."?access_key=".$conf["key"];#$conf["fileArgu"],字串,變數__FILE__的內容.$conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];#可省略參數:#$conf["header"],字串陣列,要傳送的header.$conf["catchWebContent::curlCmd"]["header"]=array("content-type: application/json");#$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".#$conf["allowAnySSLcertificate"]="";#$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.#$conf["postVar"]=array();#$conf["rawPost"]="字串",要傳送的raw post內容.$conf["catchWebContent::curlCmd"]["rawPost"]=$postJson;#$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.#$conf["catchWebContent::curlCmd"]["urlEncode"]="true";#$conf["agent"],字串,user agent的名稱.#$conf["agent"]="";#$conf["cookie"],字串,cookie位置與檔案位置.#$conf["cookie"]="";#$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".#$conf["forceNewCookie"]="";#$conf["inBg"],字串,"true"代表要在背景中執行;反之則為"false".#$conf["inBg"]="true";#$conf["bgInPorc"],字串,若跟inBg一樣為"true",則會透過proc放在背景執行且回傳proc資訊,以便監控執行狀況.預設為"false",不使用proc.#$conf["bgInProc"]="false";#參考資料:#無.#備註:#無.$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);unset($conf["catchWebContent::curlCmd"]);#如果異常if($curlCmd["status"]==="false"){#設置錯誤識別$result["status"]="false";#設置錯誤訊息$result["error"]=$curlCmd;#回傳結果return $result;}#if end#設置curl的詳細資訊$result["curl_verbose_info"]=$curlCmd;/* 範例 json content"{"id":"f1448a54da0925356faec06154989452","type":"1","common_name":"test.qbpwcf.org","additional_domains":"","created":"2024-11-27 12:05:52","expires":"2025-02-25 00:00:00","status":"draft","validation_type":null,"validation_emails":null,"replacement_for":"","validation":{"email_validation":{"test.qbpwcf.org":["admin@test.qbpwcf.org","administrator@test.qbpwcf.org","hostmaster@test.qbpwcf.org","postmaster@test.qbpwcf.org","webmaster@test.qbpwcf.org","admin@qbpwcf.org","administrator@qbpwcf.org","hostmaster@qbpwcf.org","postmaster@qbpwcf.org","webmaster@qbpwcf.org"]},"other_methods":{"test.qbpwcf.org":{"file_validation_url_http":"http:\/\/test.qbpwcf.org\/.well-known\/pki-validation\/5CED79AF9CCCB7C8633875D1A7C919FA.txt","file_validation_url_https":"https:\/\/test.qbpwcf.org\/.well-known\/pki-validation\/5CED79AF9CCCB7C8633875D1A7C919FA.txt","file_validation_content":["2C2CAB7C8B941192CB6BD9345DA3806BBC9F13A3DF3109C1E1A8B9B1ECC5B5FC","comodoca.com","42f21840bf8a7a6"],"cname_validation_p1":"_5CED79AF9CCCB7C8633875D1A7C919FA.test.qbpwcf.org","cname_validation_p2":"2C2CAB7C8B941192CB6BD9345DA3806B.BC9F13A3DF3109C1E1A8B9B1ECC5B5FC.42f21840bf8a7a6.comodoca.com"}}}}"*/#設置結果$result["content"]=$curlCmd["content"];#設置執行正常$result["status"]="true";#回傳結果return $result;}#function csr end}#class zerossl end