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! Link to comment https://forums.phpfreaks.com/topic/290735-web-service/ 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 Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489308 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 Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489311 Share on other sites More sharing options...
CroNiX Posted August 29, 2014 Share Posted August 29, 2014 try: json_decode($response->GetProspectAsJSONResult, true) Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489312 Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Still getting NULL Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489313 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)); Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489314 Share on other sites More sharing options...
nik_jain Posted August 29, 2014 Share Posted August 29, 2014 I think it should be - var_dump(json_decode($response->GetProspectAsJSONResult, true)); Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489316 Share on other sites More sharing options...
cpaoletto Posted August 29, 2014 Author Share Posted August 29, 2014 Worked beautifully, thanks you soo much!!!! Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489318 Share on other sites More sharing options...
CroNiX Posted August 29, 2014 Share Posted August 29, 2014 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. Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489320 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!!! Link to comment https://forums.phpfreaks.com/topic/290735-web-service/#findComment-1489321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.