public function testUseH9()
 {
     $serviceName = Zend_Gdata_Health::H9_SANDBOX_SERVICE_NAME;
     $client = Zend_Gdata_ClientLogin::getHttpClient($this->user, $this->pass, $serviceName);
     $h9 = new Zend_Gdata_Health($client, 'google-MyPHPApp-v1.0', true);
     $profileListFeed = $h9->getHealthProfileListFeed();
     $profileID = $profileListFeed->entry[0]->getProfileID();
     $h9->setProfileID($profileID);
     // query profile feed
     $feed1 = $h9->getHealthProfileFeed();
     $this->assertTrue($feed1 instanceof Zend_Gdata_Health_ProfileFeed);
     foreach ($feed1->getEntries() as $entry) {
         $this->assertTrue($entry instanceof Zend_Gdata_Health_ProfileEntry);
         $this->assertEquals($entry->getHttpClient(), $feed1->getHttpClient());
     }
     // send CCR
     $subject = "Title of your notice goes here";
     $body = "Notice body can contain <b>html</b> entities";
     $type = "html";
     $ccrXML = file_get_contents('Zend/Gdata/Health/_files/ccr_notice_sample.xml', true);
     $responseEntry = $h9->sendHealthNotice($subject, $body, $type, $ccrXML);
     $this->assertTrue($responseEntry instanceof Zend_Gdata_Health_ProfileEntry);
     $this->assertEquals($subject, $responseEntry->title->text);
     $this->assertEquals($body, $responseEntry->content->text);
     $this->assertEquals($type, $responseEntry->content->type);
     $this->assertXmlStringEqualsXmlString($responseEntry->getCcr()->saveXML(), $ccrXML);
 }
예제 #2
0
            if ($indent < 0) {
                $indent += $level;
            }
            $pretty[] = str_repeat(' ', $indent) . $el;
        }
    }
    $xml = implode("\n", $pretty);
    return $html_output ? htmlentities($xml) : $xml;
}
$sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
$client = Zend_Gdata_AuthSub::getHttpClient($sessionToken);
$useH9Sandbox = true;
$healthService = new Zend_Gdata_Health($client, 'MyGHAppNamev1.0', $useH9Sandbox);
$query = new Zend_Gdata_Health_Query();
$query->setDigest("true");
$profileFeed = $healthService->getHealthProfileFeed($query);
$entry = $profileFeed->entry[0];
//To print ccr
$ccr = $entry->getCcr();
$xmlStr = $ccr->saveXML($ccr);
echo '<p>' . xmlpp($xmlStr, true) . '</p>';
// digest=true was set so we only have 1 entry
$allergies = $entry->getCcr()->getAllergies();
$conditions = $entry->getCcr()->getConditions();
$immunizations = $entry->getCcr()->getImmunizations();
$lab_results = $entry->getCcr()->getLabResults();
$medications = $entry->getCcr()->getMedications();
$procedures = $entry->getCcr()->getProcedures();
//An example of using the medications data
foreach ($medications as $med) {
    $xmlStr = $med->ownerDocument->saveXML($med);