cpaoletto Posted August 29, 2014 Share Posted August 29, 2014 I'm getting the following result from a web service call. I'd like to pass it to another page, possibly using sessions, and then access specific values on that page, such as FirstName. stdClass Object ( [GetProspectAsJSONResult] => [ { "ProspectId": xxxxxx, "Keycode": "Test", "FirstName": "Test", "LastName": "Test", "Company": "Test","Email": null } ] ) I'm not sure what the best way to do this is. Thanks! Quote Link to comment Share on other sites More sharing options...
CroNiX Posted August 29, 2014 Share Posted August 29, 2014 http://php.net/manual/en/function.json-decode.php Quote Link to comment Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 When I decode it: var_dump(json_decode($response, true)); I get NULL Quote Link to comment Share on other sites More sharing options...
CroNiX Posted August 29, 2014 Share Posted August 29, 2014 (edited) try: json_decode($response->GetProspectAsJSONResult, true) Edited August 29, 2014 by CroNiX Quote Link to comment Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Still getting NULL Quote Link to comment Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Full code: $wsdl_url = "URL.asmx?WSDL";$client = new SoapClient($wsdl_url);$params = array(key" => "xxxxx","Code" => "xxxxx");$response = $client->GetProspectAsJSON($params);var_dump(json_decode($object->GetProspectAsJSONResult, true)); Quote Link to comment Share on other sites More sharing options...
Solution nik_jain Posted August 29, 2014 Solution Share Posted August 29, 2014 (edited) I think it should be - var_dump(json_decode($response->GetProspectAsJSONResult, true)); Edited August 29, 2014 by nik_jain Quote Link to comment Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Worked beautifully, thanks you soo much!!!! Quote Link to comment Share on other sites More sharing options...
CroNiX Posted August 29, 2014 Share Posted August 29, 2014 (edited) Not sure why that worked and what I had in my last post didn't. They look the same to me Oh, maybe you tried it before my edit. Edited August 29, 2014 by CroNiX Quote Link to comment Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Yes, I think I tried it before your edit. But it worked great. Thanks!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.