当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata::setMajorProtocolVersion方法代码示例

本文整理汇总了PHP中Zend_Gdata::setMajorProtocolVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::setMajorProtocolVersion方法的具体用法?PHP Zend_Gdata::setMajorProtocolVersion怎么用?PHP Zend_Gdata::setMajorProtocolVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata的用法示例。


在下文中一共展示了Zend_Gdata::setMajorProtocolVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FetchContacts

 public function FetchContacts($credential = null)
 {
     if (!$credential) {
         $credential = $this->_credential;
     } else {
         $this->_credential = $credential;
     }
     $user = $credential['username'];
     $pass = $credential['password'];
     try {
         // perform login and set protocol version to 3.0
         $client = \Zend_Gdata_ClientLogin::getHttpClient($user, $pass, 'cp');
         $gdata = new \Zend_Gdata($client);
         $gdata->setMajorProtocolVersion(3);
         // perform query and get result feed
         $query = new \Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full');
         $query->setParam("max-results", 10000);
         $feed = $gdata->getFeed($query);
         // parse feed and extract contact information
         // into simpler objects
         $results = array();
         foreach ($feed as $entry) {
             $xml = simplexml_load_string($entry->getXML());
             $obj = $this->DatatoContact($entry, $xml);
             $results[] = $obj;
         }
     } catch (Exception $e) {
         var_dump($e->getMessage());
         return;
     }
     return $results;
 }
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:32,代码来源:ContactService.php

示例2: urlencode

require_once( 'Zend/Loader.php' );
Zend_Loader::loadClass( 'Zend_Gdata' );
Zend_Loader::loadClass( 'Zend_Gdata_ClientLogin' );
Zend_Loader::loadClass( 'Zend_Http_Client' );
Zend_Loader::loadClass( 'Zend_Gdata_Query' );
Zend_Loader::loadClass( 'Zend_Gdata_Feed' );

// Perform source login
$source_client = Zend_Gdata_ClientLogin::getHttpClient( $source_user, $source_pass, 'cp' );
$source_gdata = new Zend_Gdata( $source_client );
$source_gdata->setMajorProtocolVersion( 3 );

// Perform destination login
$dest_client = Zend_Gdata_ClientLogin::getHttpClient( $dest_user, $dest_pass, 'cp' );
$dest_gdata = new Zend_Gdata( $dest_client );
$dest_gdata->setMajorProtocolVersion( 3 );

// Fetch all destination contacts
message( 'Fetching all "My Contacts" from destination account...' );
$dest_query = new Zend_Gdata_Query( 'http://www.google.com/m8/feeds/contacts/default/full' );
$dest_query->maxResults = 99999;
$dest_query->setParam( 'group', 'http://www.google.com/m8/feeds/groups/' . urlencode($dest_user) . '/base/6' ); // "My Contacts" only
$dest_feed = $dest_gdata->getFeed( $dest_query );
message( $dest_feed->totalResults . ' contacts found.' );

// Clear out all existing contacts
if ( (string) $dest_feed->totalResults > 0 ) {
	message( 'Clearing all "My Contacts" from destination account...' );
	foreach ( $dest_feed as $entry ) {

		if ( !$editlink = $entry->getEditLink() )
开发者ID:ninnypants,项目名称:Gmail-Contact-Sync,代码行数:31,代码来源:sync.php


注:本文中的Zend_Gdata::setMajorProtocolVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。