本文整理汇总了PHP中Zend_Gdata::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::post方法的具体用法?PHP Zend_Gdata::post怎么用?PHP Zend_Gdata::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata
的用法示例。
在下文中一共展示了Zend_Gdata::post方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
public function post($data, $uri = null, $remainingRedirects = null, $contentType = null, $extraHeaders = null)
{
try {
return parent::post($data, $uri, $remainingRedirects, $contentType, $extraHeaders);
} catch (Zend_Gdata_App_HttpException $e) {
self::throwServiceExceptionIfDetected($e);
}
}
示例2: post
/**
* POST xml data to Google with authorization headers set
*
* @param string $xml
* @return Zend_Http_Response
*/
public function post($xml, $uri = null)
{
if (!isset($this->blogName)) {
throw Zend::exception('Zend_Gdata_Exception', 'You must specify a blog name.');
}
if ($uri == null) {
$uri = "http://www.blogger.com/feeds/{$this->blogName}/posts/default";
}
return parent::post($xml, $uri);
}
示例3: createContactInGmail
/**
* creating/adding a contact in user's Gmail account.
* @param array : contact details
* @return void : sets the status
* @see class : Gdata
*/
function createContactInGmail($contact)
{
$this->setLog("\n---------createContactInGmail ------\n" . $contact . "\n-----------end-----\n");
global $_SESSION, $_GET;
$client = $this->client;
$xml = "<?xml version='1.0'?>";
$xml .= "<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'\n xmlns:gd='http://schemas.google.com/g/2005' Content-Type='application/atom+xml'>";
$xml .= "<atom:category scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/contact/2008#contact' />";
if ($contact['name']) {
$xml .= "<atom:title type='text'>" . htmlentities($contact['name'], ENT_QUOTES) . "</atom:title>";
}
//$xml .= "<atom:content type='text'>content</atom:content>";
if ($contact['email_Work']) {
$xml .= "<gd:email rel='http://schemas.google.com/g/2005#work' address='" . $contact['email_Work'] . "' />";
}
if ($contact['email_Home']) {
$xml .= "<gd:email rel='http://schemas.google.com/g/2005#home' address='" . $contact['email_Home'] . "' />";
}
if ($contact['email_Other']) {
$xml .= "<gd:email rel='http://schemas.google.com/g/2005#other' address='" . $contact['email_Other'] . "' />";
}
if ($contact['phone_Work']) {
$xml .= "<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>" . $contact['phone_Work'] . "</gd:phoneNumber>";
}
if ($contact['phone_Home']) {
$xml .= "<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>" . $contact['phone_Home'] . "</gd:phoneNumber>";
}
if ($contact['phone_Mobile']) {
$xml .= "<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>" . $contact['phone_Mobile'] . "</gd:phoneNumber>";
}
if ($contact['addr_Work']) {
$xml .= "<gd:postalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>" . htmlentities($contact['addr_Work'], ENT_QUOTES) . "</gd:postalAddress>";
}
if ($contact['addr_Home']) {
$xml .= "<gd:postalAddress rel='http://schemas.google.com/g/2005#home' >" . htmlentities($contact['addr_Home'], ENT_QUOTES) . "</gd:postalAddress>";
}
if ($contact['addr_Other']) {
$xml .= "<gd:postalAddress rel='http://schemas.google.com/g/2005#other' >" . htmlentities($contact['addr_Other'], ENT_QUOTES) . "</gd:postalAddress>";
}
if ($contact['company']) {
$xml .= "<gd:organization rel='http://schemas.google.com/g/2005#other'>";
$xml .= "<gd:orgName>" . htmlentities($contact['company'], ENT_QUOTES) . "</gd:orgName>";
if ($contact['position']) {
$xml .= "<gd:orgTitle>" . htmlentities($contact['position'], ENT_QUOTES) . "</gd:orgTitle>";
}
$xml .= "</gd:organization>";
}
$xml .= "</atom:entry>";
$useremailid = urlencode($_SESSION["uEmail"]);
//$url = 'http://www.google.com/m8/feeds/contacts/'.$_SESSION["uEmail"].'%40gmail.com/full';
$url = 'http://www.google.com/m8/feeds/contacts/' . $useremailid . '/full';
$gdata = new Zend_Gdata($client);
try {
$retVal = $gdata->post($xml, $url);
//$retVal = $gdata->post($xml,$url);
if ($retVal) {
$q_email = new sqlQuery($this->getDbCon());
if ($contact['email_Work']) {
$sql_email_ins = "INSERT INTO \n temp_gmail_emails(email_address)\n VALUES('" . $contact['email_Work'] . "')\n ";
$q_email->query($sql_email_ins);
}
if ($contact['email_Home']) {
$sql_email_ins = "INSERT INTO \n temp_gmail_emails(email_address)\n VALUES('" . $contact['email_Home'] . "')\n ";
$q_email->query($sql_email_ins);
}
if ($contact['email_Other']) {
$sql_email_ins = "INSERT INTO \n temp_gmail_emails(email_address)\n VALUES('" . $contact['email_Other'] . "')\n ";
$q_email->query($sql_email_ins);
}
$q_email->free();
}
} catch (Exception $e) {
$status_code = $gdata->getHttpClient()->getLastResponse()->getStatus();
$this->status_code_desc = $this->getStatusDescription($status_code);
}
}