How to read this object in php to retrieve email -
this 1 loop want retrieve emails.
guzzle\service\resource\model object ( [structure:protected] => [data:protected] => array ( [type] => user.list [pages] => array ( [type] => pages [next] => https://xxxx.com/users?per_page=50&page=2 [page] => 1 [per_page] => 50 [total_pages] => 234 ) [users] => array ( [0] => array ( [type] => user [id] => 560b99861cf5c8112a00012e [user_id] => [anonymous] => [email] => abcd@gmail.com [name] => shivaji [pseudonym] => [avatar] => array ( [type] => avatar [image_url] => ) [app_id] => xhxxxxf [companies] => array ( [type] => company.list [companies] => array ( ) ) [location_data] => array ( [type] => location_data [city_name] => [continent_code] => [country_name] => india [latitude] => 28.4667 [longitude] => 77.0333 [postal_code] => [region_name] => haryana [timezone] => asia/calcutta [country_code] => ind ) [last_request_at] => 1443600774 [last_seen_ip] => 125.19.45.202 [created_at] => 1443600774 [remote_created_at] => 1443600686 [signed_up_at] => 1443600686 [updated_at] => 1443600774 [session_count] => 1 [social_profiles] => array ( [type] => social_profile.list [social_profiles] => array ( ) ) [unsubscribed_from_emails] => [user_agent_data] => mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/39.0.2171.95 safari/537.36 [tags] => array ( [type] => tag.list [tags] => array ( ) ) [segments] => array ( [type] => segment.list [segments] => array ( [0] => array ( [type] => segment [id] => 551d080b5e3a0fc0f4000043 ) [1] => array ( [type] => segment [id] => 551d080b5e3a0fc0f4000042 ) ) ) [custom_attributes] => array ( [cust_id] => ) ) )
try
$users = $your_response_array["data"]["users"]; foreach ($users $user) { var_dump($user["email"] ); }
and if object you're dealing need use:
$users = $your_response_obj->data["users"];
but dump states "data" array protected need read guzzle docs find out method gives access data attribute.
Comments
Post a Comment