PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Profile List Feed

NOTE: This feed is only available when using ClientLogin

Since ClientLogin requires a profile ID with each of its feeds, applications will likely want to query this feed first in order to select the appropriate profile. The profile list feed returns Atom entries corresponding each profile in the user's Google Health account. The profile ID is returned in the Atom <content> and the profile name in the <title> element.

Query The Feed

To execute a query against the profile list feed, call the service's getHealthProfileListFeed() method:

<?php
$client 
Zend_Gdata_ClientLogin::getHttpClient('user@gmail.com',
                                                
'pa$$word',
                                                
'health');
$healthService = new Zend_Gdata_Health($client);
$feed $healthService->getHealthProfileListFeed();

// print each profile's name and id
$entries $feed->getEntries();
foreach (
$entries as $entry) {
    echo 
'<p>Profile name: ' $entry->getProfileName() . '<br>';
    echo 
'profile ID: ' $entry->getProfileID() . '</p>';
}

Once you've determined which profile to use, call setProfileID() with the profileID as an argument. This will restrict subsequent API requests to be against that particular profile:

<?php
// use the first profile
$profileID $feed->entry[0]->getProfileID();
$healthService->setProfileID($profileID);

$profileFeed $healthService->getHealthProfileFeed();

$profileID $healthService->getProfileID();
echo 
'<p><b>Queried profileID</b>: ' $profileID '</p>';

Zend Framework