php - 响应表单 API 和在 php 中使用

标签 php web-services

<分区>

我有来自 API Web 服务的响应,我想获取此对象的值。示例:TimeStamp、TransactionID、SubscriptionResponse

并在 HTML 代码中显示此值不同的 DIV。 如何获得这个值(value)并使用主题??

API 的响应:

object(SubscriptionResponseContainer)#11 (5) { 
    ["Timestamp":protected]=> string(25) "2015-09-15T04:30:00+04:30"        
    ["TransactionId":protected]=> string(10) "1445756101" 
    ["SubscriptionResponse":protected]=> array(1) { 
        [0]=> object(SubscriptionResponseItemCollection)#12 (2) {    
            ["Activate":protected]=> NULL 
            ["Renew":protected]=> NULL 
        } 
    } 
    ["SubscriptionError":protected]=> array(1) { 
        [0]=> object(SubscriptionResponseErrorCollection)#13 (2) { 
            ["ActivateError":protected]=> array(1) { 
                [0]=> object(ResponseItemErrorType)#14 (4) { 
                    ["UnitId":protected]=> int(1) 
                    ["SubscriberId":protected]=> string(11) "09394354387" 
                    ["ErrorCode":protected]=> int(1)   
                    ["ErrorMessage":protected]=> string(70) "SubscriberId specified in the activate order was previously activated." 
                } 
            } 
            ["RenewError":protected]=> NULL 
        } 
    } 
    ["TransactionError":protected]=> NULL 
} 

最佳答案

例如:

$timestamp=$result['Timestamp'];
$TransactionID=$result['Timestamp']['TransactionID'];

关于php - 响应表单 API 和在 php 中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33327149/

相关文章:

c# - 从 webservice 返回两个值

php - SQL 查询包含一个范围内的到期日期,但如果它们有另一个相同类型的实例则排除

java - 我可以在 tomcat 3.3.1 上使用哪种 Web 服务引擎?

web-services - 如何模拟 WS 客户端并在 Camel route 提供响应

Windows Azure 中的 PHP Web 服务 Nusoap

javascript - 使用 javascript 调用 express js restful webservice => 结果总是空响应

php - Symfony2 保护所有子域

php - 通知: Undefined index: buttonstyle in

php - 使用 dompdf 从数据库渲染数据时出错

PHP PDF 使用 blob 数据进行动态压缩