Question

I am trying to get the contacts of a user from Yahoo, I'm using the PHP SDK.

But I keep getting an empty result:

{ ["query"]=> object(stdClass)#14 (4) { ["count"]=> int(0) ["created"]=> string(20) "2012-11-06T18:05:30Z" ["lang"]=> string(5) "en-US" ["results"]=> NULL } } 

As far as I can tell, the authentication is working fine, but I just get no result here...

This is the code I am using to get the result above:

$session = YahooSession::requireSession($yahooConsumerKey,$yahooConsumerSecret,$yahooAppID);

$query = sprintf("select * from social.contacts where guid=me;");  
$response = $session->query($query); 

var_dump($response);

/**** printing the contact emails starts ****/
if(isset($response)){

   foreach($response->query->results->contact as $id){

       foreach($id->fields as $subid){

               if( $subid->type == 'email' )
               echo $subid->value."<br />";
       }
   }
}

Thanks in advance!

Was it helpful?

Solution

I have found what the problem was, If you import contacts into Yahoo from Facebook, these will not appear on your YQL response, so the solution is to simply add some contacts manually so you can see them in your response, not an issue with the code but a bug with the import on Yahoo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top