Extracting Emails Getcontacts Yahoo Sdk

most codes dont work properly so i wrote my own simple code:

// fetch latest user data
$user_contacts  = $oauthapp->getContacts(null,0,20);
//print_r($user_contacts);
foreach ($user_contacts->contact as $contact)
{
	//echo $contact->id."<br>";
	$far = $contact->fields;
	if(is_array($far)){
		if(strstr($far[0]->value, "@")){
			$emails[] = $far[0]->value;
		}else{
			$emails[] = $far[0]->value."@yahoo.com";
		}

	}
}


This entry was posted in everyday tips. Bookmark the permalink.