I am playing around with iContact API and am running into an issue. After creating a contact using the api I am attempting to retrieve the most recent response so I can parse the contactId in order to send that contact a message or add them to a list.
// 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();
When print the $obj var this is what I get
{"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;
Error Message: Notice: Trying to get property of non-object in …(path)... on line 24
I looked on other posts and attempted to duplicate some of the same solutions but nothing seemed to work. Thanks for any help in advanced.