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

Creating a new Gdata client

Create a new object of class Zend_Gdata_App, Zend_Gdata, or one of the subclasses available that offer helper methods for service-specific behavior.

The single optional parameter to the Zend_Gdata_App constructor is an instance of Zend_Http_Client. If you don't pass this parameter, Zend_Gdata creates a default Zend_Http_Client object, which will not have associated credentials to access private feeds. Specifying the Zend_Http_Client object also allows you to pass configuration options to that client object.

<?php
$client 
= new Zend_Http_Client();
$client->setConfig( ...options... );

$gdata = new Zend_Gdata($client);

Beginning with Zend Framework 1.7, support has been added for protocol versioning. This allows the client and server to support new features while maintaining backwards compatibility. While most services will manage this for you, if you create a Zend_Gdata instance directly (as opposed to one of its subclasses), you may need to specify the desired protocol version to access certain server functionality.

<?php
$client 
= new Zend_Http_Client();
$client->setConfig( ...options... );

$gdata = new Zend_Gdata($client);
$gdata->setMajorProtocolVersion(2);
$gdata->setMinorProtocolVersion(null);

Also see the sections on authentication for methods to create an authenticated Zend_Http_Client object.

Zend Framework