If you're going to use ClientLogin on /h9, you also need to pass the $usehH9Sanbox=true to Zend_Gdata_Health():
$h9Service = new Zend_Gdata_Health($client, 'yourAppName', true); Eric On Jun 19, 7:39 am, hobert <[email protected]> wrote: > Hi > > I'm very new to the Google Health API and can't get a simple example > to work: > ******************************** > <?php > set_include_path('/home/hobart/Desktop/ZendGdata-1.8.3/library'); > require_once 'Zend/Loader.php'; > Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); > Zend_Loader::loadClass('Zend_Gdata_Health'); > > // Parameters for ClientLogin authentication > $healthServiceName = Zend_Gdata_Health::H9_SANDBOX_SERVICE_NAME; > > // Create an authenticated HTTP client > $client = Zend_Gdata_ClientLogin::getHttpClient("**[email protected]", > "*****", $healthServiceName); > // Create an instance of the Health service > $healthService = new Zend_Gdata_Health($client); > $profileListFeed = $healthService->getHealthProfileListFeed(); > // print each profile's name and id > foreach ($profileListFeed->getEntries() as $entry) { > echo '<p>Profile name: ' . $entry->getProfileName() . '<br>'; > echo 'profile ID: ' . $entry->getProfileID() . '</p>';} > > ?> > *********************************** > (Note: the username, password have been redacted) > When I execute the above php script on the command-line, I get: > ************************************* > Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with > message 'Expected response code 200, got 401 > <HTML> > <HEAD> > <TITLE>Token invalid</TITLE> > </HEAD> > <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> > <H1>Token invalid</H1> > <H2>Error 401</H2> > </BODY> > </HTML> > *********************************** > Anybody have any idea what I'm doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Health Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/googlehealthdevelopers?hl=en -~----------~----~----~----~------~----~------~--~---
