iContact php jSON parsing issue -
I am playing with the iContact API and running into a problem. After creating a contact using the API, I am trying to retrieve the recent feedback so that I can parse the contact ID to send that message to the contact or add it to the list. New customer iContact var_dump ($ oiContact- & gt; addContact ('usersemailaddress@here.com), blank, empty,' joe ',' smith ', blank,' 123 somewhere LN ' , 'Ep 12', 'Somewhere', 'NW', '12345', '123-456-7890', '123-456-7890', Faucet)); // final response is received (result $ obj = $ oi contact-> getLastResponse ();
are shown below when $ obj vars print It gets <">" contact ": [{" contactId ":" 1009090 "," prefix ":" "" FirstName ":" which "," lastName ":" Smith " "123456", "Postcode": "NW", "Postal Code": "A", "City": "Au 12", "City": "Anywhere", "State": "Suffix": "123 Somewhere LN", "Road 2" "Phone": "123-456-789", "fax": "123-456-7890", "business": "", "email": "usersemailaddress@here.com", "createDate": " 2014-04-24 01:31:59 "BounceCount": "", "ST Etas ":" normal "}]} // decode Jason object and dumb it $ data = json_decode ($ obj, tru); $ data-> contact [0] -> contactId; < / pre>
Error message: Notice: Trying to get the property of non-object ?? | (Path) ... on line 24 I considered other posts and tried to duplicate a few solutions but nothing was to work. Thanks for any help in advanced. If you are going to enter OJ, delete the TRUE from the Ct method json_decode function parameter list. If you pass TRUE, then it gives an array. Otherwise you will have to use it this way.
$ data = json_decode ($ obj);
// decode json object and echo it $ data = json_decode ($ obj, TRUE); Echo $ data ['contact'] [0] ['contact iid'];
Comments
Post a Comment