我正在嘗試將支付網關集成到簡單的PHP站點(我自己的站點)中,並且網關只接受SOAP格式的數據。我完全不知道SOAP是什麼,但感謝谷歌,我現在知道它是怎麼樣的(至少)。使用PHP發送SOAP請求並獲取返回的響應
基本上,我需要發送一堆客戶數據和支付數據到網關根據收到的響應行事。以下是示例請求代碼和示例響應代碼。他們只提供要發佈到的網址,即http://69.94.141.22/SaveTransactions.asmx
。
請求
POST /SaveTransactions.asmx HTTP/1.1
Host: 69.94.141.22
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SendTransactionsAction xmlns="http://tempuri.org/">
<strUserName>string</strUserName>
<strPassword>string</strPassword>
<strSecureKey>string</strSecureKey>
<strFirstName>string</strFirstName>
<strLastName>string</strLastName>
<strPhoneNumber>string</strPhoneNumber>
<strStreetNumber>string</strStreetNumber>
<strUnitNumber>string</strUnitNumber>
<strStreetName>string</strStreetName>
<strCity>string</strCity>
<strState>string</strState>
<strZipCode>string</strZipCode>
<strEmailAddress>string</strEmailAddress>
<strBankName>string</strBankName>
<strRoutingNo>string</strRoutingNo>
<strAccountNumber>string</strAccountNumber>
<strCheckNo>string</strCheckNo>
<strAmount>string</strAmount>
<strNotes>string</strNotes>
</SendTransactionsAction>
</soap12:Body>
</soap12:Envelope>
響應
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SendTransactionsActionResponse xmlns="http://tempuri.org/">
<SendTransactionsActionResult>string</SendTransactionsActionResult>
</SendTransactionsActionResponse>
</soap12:Body>
</soap12:Envelope>
如何發佈這些到URL提供了使用PHP和如何獲取該響應SendTransactionsActionResult
從返回的響應?
我不是要求你爲我做這件事,而是像代碼一樣簡單的開始會有很大的幫助。
在此先感謝