I hava a variable $tinder->recommendations. When i keep it in var_dump.
Like var_dump($tinder->recommendations);
It gives an array which is in below.
object(stdClass)#7 (2) {
["status"]=> int(200)
["results"]=> array(47) {
[0]=> object(stdClass)#34 (23) {
["group_matched"]=> bool(false)
["distance_mi"]=> int(14)
["content_hash"]=> string(47) "5nVT6PhabtGrSRqiRiLAfqXH1LFkps25sagHawimxt5Eh4r"
["common_friends"]=> array(0) { }
["common_likes"]=> array(0) { }
["common_friend_count"]=> int(0)
["common_like_count"]=> int(0)
["connection_count"]=> int(0)
["_id"]=> string(24) "583c9fd7298a09eb42f32df1"
["bio"]=> string(353) "Family, friends, my pooches, music. Old fashioned as far as relationships go. I'm not an apple polisher. Not sure if this is the place to find a keeper, but who knows. I'd say this is better than meeting someone at a bar haha. Music: Blues, Soul, Doo Wop, Folk, Bluegrass, Country, Doom, Punk Red Heeler & Old English Bulldog 6'-0" for those who care"
["birth_date"]=> string(24) "1989-11-23T20:12:56.493Z"
["name"]=> string(5) "Trent"
["ping_time"]=> string(24) "2014-12-09T00:00:00.000Z"
["photos"]=> array(6) {
[0]=> object(stdClass)#33 (3) {
["id"]=> string(36) "318ad35d-3e14-44c6-8348-3aacfc4594bd"
["url"]=> string(92) "http://images.gotinder.com/583c9fd7298a09eb42f32df1/318ad35d-3e14-44c6-8348-3aacfc4594bd.jpg" ["processedFiles"]=> array(4) {
[0]=> object(stdClass)#35 (3) {
["url"]=> string(100) "http://images.gotinder.com/583c9fd7298a09eb42f32df1/640x640_318ad35d-3e14-44c6-8348-3aacfc4594bd.jpg"
["height"]=> int(640)
["width"]=> int(640) }
[1]=> object(stdClass)#36 (3) {
["url"]=> string(100) "http://images.gotinder.com/583c9fd7298a09eb42f32df1/320x320_318ad35d-3e14-44c6-8348-3aacfc4594bd.jpg"
["height"]=> int(320)
["width"]=> int(320) }
[2]=> object(stdClass)#37 (3) {
["url"]=> string(100) "http://images.gotinder.com/583c9fd7298a09eb42f32df1/172x172_318ad35d-3e14-44c6-8348-3aacfc4594bd.jpg"
["height"]=> int(172)
["width"]=> int(172) }
Now i want to get only value from '_id' & 'name' and save them on database. I've tried code bellow but it gives no result, so can you help me, how can I extract value of _id & name and save them on database?
if ($tinder->recommendations() > 0) {
foreach($tinder->recommendations() as $contact) {
if( property_exists( $contact, '_id') &&
property_exists( $contact, 'name')){
echo "$contact->_id";
} else {
echo "property doesn't exists";
}
}
} else {
echo "object doesn't exists";
}
result: property doesn't exists.
if ($tinder->recommendations > 0) {
foreach($tinder->recommendations as $contact) {
if( property_exists( $contact, '_id') &&
property_exists( $contact, 'name')){
echo "$contact->_id";
} else {
echo "property doesn't exists";
}
}
} else {
echo "object doesn't exists";
}
result: object doesn't exists.
if ($tinder->recommendations->results > 0) {
foreach($tinder->recommendations->results as $contact) {
if( property_exists( $contact, '_id') &&
property_exists( $contact, 'name')){
echo "$contact->_id";
} else {
echo "property doesn't exists";
}
}
} else {
echo "object doesn't exists";
}
result: object doesn't exists.
I know this question has been asked before, but I've failed to figure out with the answer that's why I'm asking here. any help would be appreciated, Thanks.