Domanda

I need a little help about a PHP FB app.

Matter is that I wan't to access the significant_other_id as $relationId.

First I get the authorization by user via link: https://www.facebook.com/dialog/permissions.request?app_id=XXX&display=page&next=XLINK&response_type=code&perms=publish_stream,user_relationships

Then after authorization in php file I try this:

<?php

include('src/facebook.php');
$facebook = new Facebook(array(
  'appId'  => 'XX',
  'secret' => 'XX',
  'cookie' => true,
));

$user_profile = $facebook->api('/me','GET');

echo $user_profile['relationship_status']; //Prints ok, requested info
echo $user_profile['significant_other_id']; //Prints nothing

I wasn't able to get that id :S if anyone has experience on this your reply would be great.

Thanks.

È stato utile?

Soluzione

According to the documentation, significant_other comes back as an object containing name and id, so try:

echo $user_profile['significant_other']['id'];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top