我正在使用 iContact API 并遇到问题。使用 api 创建联系人后,我尝试检索最近的响应,以便解析contactId 以便向该联系人发送消息或将其添加到列表中。
// adds new client to iContact
var_dump($oiContact->addContact('usersemailaddress@here.com', null, null, 'Joe', 'Smith', null, '123 Somewhere Ln', 'Apt 12', 'Somewhere', 'NW', '12345', '123-456-7890', '123-456-7890', null));
// Gets last response (results are showing below
$obj = $oiContact->getLastResponse();
当打印 $obj var 这就是我得到的
{"contacts":[{"contactId":"1009090","prefix":"","firstName":"Joe","lastName":"Smith","suffix":"","street":"123 Somewhere Ln","street2":"Apt 12","city":"Somewhere","state":"NW","postalCode":"12345","phone":"123-456-7890","fax":"123-456-7890","business":"","email":"usersemailaddress@here.com","createDate":"2014-04-24 01:31:59","bounceCount":"","status":"normal"}]}
//decode json object and echo it
$data = json_decode($obj,TRUE);
echo $data->contacts[0]->contactId;
错误消息: 注意:尝试在第 24 行的...(路径)...中获取非对象的属性
我查看了其他帖子并尝试复制一些相同的解决方案,但似乎没有任何效果。感谢您在高级方面的任何帮助。