How to properly parse a stdobject
Posted: Sun Feb 24, 2013 5:11 pm
How could I parse the following stdobject to just get two arrays, one with name and the other with email.
for example I'd want to come up with:
to get the name I would need to iterate and concatenate givenName.middleName.familyName
yet there are plenty of those stdobjects which don't have those keys, only email for some of these it appears as it comes from Yahoo, for those it can be
I just can't get through with my mind on this. Any help, direction very much appreciated.
for example I'd want to come up with:
Code: Select all
$my_arr[0]='mauro@serviweb.es';
$my_arr2[0]='Mauro Francisco Serviweb.es';yet there are plenty of those stdobjects which don't have those keys, only email for some of these it appears as it comes from Yahoo, for those it can be
Code: Select all
$my_arr[1]='email@domain.com';
$my_arr2[1]='';Code: Select all
stdClass Object
(
[contact] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777834
[isConnection] => false
[id] => 16777834
[fields] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777834/email/16778439
[id] => 16778439
[type] => email
[value] => mauro@serviweb.es
[editedBy] => OWNER
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777834/name/16778438
[id] => 16778438
[type] => name
[value] => stdClass Object
(
[givenName] => Mauro
[middleName] => Francisco
[familyName] => - Serviweb.es
[prefix] =>
[suffix] =>
[givenNameSound] =>
[familyNameSound] =>
)
[editedBy] => OWNER
)
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777834/category/Gmail
[id] => 2
[name] => Gmail
)
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777858
[isConnection] => false
[id] => 16777858
[fields] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777858/email/16778474
[id] => 16778474
[type] => email
[value] => queenymj@naver.com
[editedBy] => OWNER
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777858/name/16778473
[id] => 16778473
[type] => name
[value] => stdClass Object
(
[givenName] => 유미정
[middleName] =>
[familyName] =>
[prefix] =>
[suffix] =>
[givenNameSound] =>
[familyNameSound] =>
)
[editedBy] => OWNER
)
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777858/category/Gmail
[id] => 2
[name] => Gmail
)
)
[2] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777861
[isConnection] => false
[id] => 16777861
[fields] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777861/email/16778478
[id] => 16778478
[type] => email
[value] => ernesto@you-on-a-diet.net
[editedBy] => OWNER
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777861/name/16778477
[id] => 16778477
[type] => name
[value] => stdClass Object
(
[givenName] => You
[middleName] => On
[familyName] => A Diet (Ernesto Martinez)
[prefix] =>
[suffix] =>
[givenNameSound] =>
[familyNameSound] =>
)
[editedBy] => OWNER
)
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777861/category/Gmail
[id] => 2
[name] => Gmail
)
)
[3] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777827
[isConnection] => false
[id] => 16777827
[fields] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777827/email/16778427
[id] => 16778427
[type] => email
[value] => cullensabcs@gmail.com
[editedBy] => OWNER
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777827/name/16778426
[id] => 16778426
[type] => name
[value] => stdClass Object
(
[givenName] => Cullen's
[middleName] =>
[familyName] => Abc's
[prefix] =>
[suffix] =>
[givenNameSound] =>
[familyNameSound] =>
)
[editedBy] => OWNER
)
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777827/category/Gmail
[id] => 2
[name] => Gmail
)
)
[4] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777688
[isConnection] => false
[id] => 16777688
[fields] => Array
(
[0] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777688/email/16778220
[id] => 16778220
[type] => email
[value] => abelfernandez@adinet.com.uy
[editedBy] => OWNER
)
[1] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777688/name/16778219
[id] => 16778219
[type] => name
[value] => stdClass Object
(
[givenName] => abelfernandez@adinet.com.uy
[middleName] =>
[familyName] =>
[prefix] =>
[suffix] =>
[givenNameSound] =>
[familyNameSound] =>
)
[editedBy] => OWNER
)
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777688/category/Gmail
[id] => 2
[name] => Gmail
)
)
[5] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777883
[isConnection] => false
[id] => 16777883
[fields] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777883/email/16778511
[id] => 16778511
[type] => email
[value] => aboutcareers@yahoo-inc.com
[editedBy] => OWNER
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777883/category/Gmail
[id] => 2
[name] => Gmail
)
)
[6] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777780
[isConnection] => false
[id] => 16777780
[fields] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777780/email/16778356
[id] => 16778356
[type] => email
[value] => administracion@outletmayorista.com
[editedBy] => OWNER
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777780/category/Gmail
[id] => 2
[name] => Gmail
)
)
[7] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777689
[isConnection] => false
[id] => 16777689
[fields] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777689/email/16778221
[id] => 16778221
[type] => email
[value] => adohio@youthfullook.com
[editedBy] => OWNER
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777689/category/Gmail
[id] => 2
[name] => Gmail
)
)
[8] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777707
[isConnection] => false
[id] => 16777707
[fields] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777707/email/16778247
[id] => 16778247
[type] => email
[value] => afiliados@888.com
[editedBy] => OWNER
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777707/category/Gmail
[id] => 2
[name] => Gmail
)
)
[9] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777856
[isConnection] => false
[id] => 16777856
[fields] => stdClass Object
(
[created] => 2012-11-19T16:00:44Z
[updated] => 2012-11-19T16:00:44Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777856/email/16778470
[id] => 16778470
[type] => email
[value] => agentwebhelp@aol.com
[editedBy] => OWNER
)
[categories] => stdClass Object
(
[created] => 2013-02-20T13:56:57Z
[updated] => 2013-02-20T13:56:57Z
[uri] => http://social.yahooapis.com/v1/user/VTHOM3XZ6UPO3ISGP3ZD43PQOQ/contact/16777856/category/Gmail
[id] => 2
[name] => Gmail
)
)
)
)