seran129 Posted July 31, 2014 Share Posted July 31, 2014 I call a web service and it retuens the values in the following format $response = $client->submitRequest($requestParams); Which returns stdClass Object( [return] => stdClass Object ( [result_code] => 0 [result_data] => City[0]=Chicago [message_text] => )) what I want is just the value for [result_data] => City[0]=Chicago assigned to a variable Psedo Code $city = [result_data] => City[0]=Chicago; so that $city = Chicago; Quote Link to comment https://forums.phpfreaks.com/topic/290208-parse-the-return-values-of-a-webservice-object/ Share on other sites More sharing options...
Ch0cu3r Posted July 31, 2014 Share Posted July 31, 2014 what I want is just the value for[result_data] => City[0]=Chicago Thats is a strange value to be returned from an api it looks to me result_data should contain an array maybe? But anyway to answer your question how to get the result_data value you'd use $city = $response->return->result_data; To remove city[0]= apply this $city = str_replace('city[0]=', '', $city); Quote Link to comment https://forums.phpfreaks.com/topic/290208-parse-the-return-values-of-a-webservice-object/#findComment-1486553 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.