我有以下字符串:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/UKash/Service1"><UKashTransaction><txCode>99</txCode><txDescription>Failed</txDescription><settleAmount> <settleAmount><transactionId>1341481253EDFC871620</transactionId><changeIssueVoucherNumber> <changeIssueVoucherNumber><changeIssueVoucherCurr> <changeIssueVoucherCurr><changeIssueAmount> <changeIssueAmount><changeIssueExpiryDate> <changeIssueExpiryDate><ukashTransactionId> <ukashTransactionId><currencyConversion> <currencyConversion><errCode>219</errCode><errDescription>Invalid Voucher Number</errDescription> <UKashTransaction></string></xml>
我想获取该字符串的一些属性,例如 txDescrition 等,我尝试了不同的变体但无法获得结果。我正在使用 php,如果有人可以提供帮助,我将非常感激,因为我被阻止了。
更新:
问题是我没有将字符串格式化为有效,所以我使用 curl 这就是我从网关得到的:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/UKash/Service1"><UKashTransaction><txCode>99</txCode><txDescription>Failed</txDescription><settleAmount></settleAmount><transactionId>13414821393ED286BF2A</transactionId><changeIssueVoucherNumber></changeIssueVoucherNumber><changeIssueVoucherCurr></changeIssueVoucherCurr><changeIssueAmount></changeIssueAmount><changeIssueExpiryDate></changeIssueExpiryDate><ukashTransactionId></ukashTransactionId><currencyConversion></currencyConversion><errCode>219</errCode><errDescription>Invalid Voucher Number</errDescription></UKashTransaction></string>
肿瘤坏死因子。