Previous Next

Zend_Service_DeveloperGarden

Introduction to DeveloperGarden

Developer Garden is the name of Deutsche Telekom’s developer community. Developer Garden offers you access to core services of Deutsche Telekom, such as voice connections (Voice Call) or sending text messages (Send SMS) via open interfaces (Open APIs). You can access the Developer Garden services directly via SOAP or REST.

The family of Zend_Service_DeveloperGarden components provides a clean and simple interface to the » Developer Garden APIs and additionally offers functionality to improve handling and performance.

  • BaseUserService: Class to manage API quota and user accounting details.

  • IPLocation: Locale the given IP and returns geo coordinates. Works only with IPs allocated in the network of the Deutsche Telekom.

  • LocalSearch: Allows you to search with options nearby or around a given geo coordinate or city.

  • SendSMS: Send a SMS or Flash SMS to a given number.

  • SMSValidation: You can validate a number to use it with SendSMS for also supply a back channel.

  • VoiceCall: Initiates a call between two participants.

  • ConferenceCall: You can configure a whole conference room with participants for an adhoc conference or you can also schedule your conference.

The backend SOAP API is documented » here.

Sign Up for an Account

Before you can start using the DeveloperGarden API, you first have to » sign up for an account.

The Environment

With the DeveloperGarden API you have the possibility to choose between 3 different development environments.

  • production: In Production environment there are no usage limitations. You have to pay for calls, sms and other services with costs.

  • sandbox: In the Sandbox mode you can use the same features (with limitations) as in the production without to paying for them. This environment is suitable for testing your prototype.

  • mock: The Mock environment allows you to build your application and have results but you do not initiate any action on the API side. This environment is intended for testing during development.

For every environment and service, there are some special features (options) available for testing. Please look » here for details.

Your configuration

You can pass to all classes an array of configuration values. Possible values are:

  • username: Your DeveloperGarden API username.

  • password: Your DeveloperGarden API password.

  • environment: The environment that you selected.

Example #1 Configuration Example

require_once 'Zend/Service/DeveloperGarden/SendSms.php';
$config = array(
    'username'    => 'yourUsername',
    'password'    => 'yourPassword',
    'environment' => Zend_Service_DeveloperGarden_SendSms::ENV_PRODUCTION,
);
$service = new Zend_Service_DeveloperGarden_SendSms($config);

BaseUserService

The class can be used to set and get quota values for the services and to fetch account details.

The getAccountBalance() method fetches an array of account id's with the current balance status (credits).

Example #2 Get account balance example

$service = new Zend_Service_DeveloperGarden_BaseUserService($config);
print_r($service->getAccountBalance());

Get quota information

You can fetch quota informations for a specific service module with the provided methods.

Example #3 Get quota information example

$service = new Zend_Service_DeveloperGarden_BaseUserService($config);
$result = $service->getSmsQuotaInformation(
    Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
);
echo 'Sms Quota:
'; echo 'Max Quota: ', $result->getMaxQuota(), '
'; echo 'Max User Quota: ', $result->getMaxUserQuota(), '
'; echo 'Quota Level: ', $result->getQuotaLevel(), '
';

You get a result object that contains all the information you need, optional you can pass to the QuotaInformation method the environment constant to fetch the quota for the specific environment.

Here a list of all getQuotaInformation methods:

  • getConfernceCallQuotaInformation()

  • getIPLocationQuotaInformation()

  • getLocalSearchQuotaInformation()

  • getSmsQuotaInformation()

  • getVoiceCallQuotaInformation()

Change quota information

To change the current quota use one of the changeQuotaPool methods. First parameter is the new pool value and the second one is the environment.

Example #4 Change quota information example

$service = new Zend_Service_DeveloperGarden_BaseUserService($config);
$result = $service->changeSmsQuotaPool(
    1000,
    Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
);
if (!$result->hasError()) {
    echo 'updated Quota Pool';
}

Here a list of all changeQuotaPool methods:

  • changeConferenceCallQuotaPool()

  • changeIPLocationQuotaPool()

  • changeLocalSearchQuotaPool()

  • changeSmsQuotaPool()

  • changeVoiceCallQuotaPool()

IP Location

This service allows you to retrieve location information for a given IP address.

There are some limitations:

  • The IP address must be in the T-Home network

  • Just the next big city will be resolved

  • IPv6 is not supported yet

Example #5 Locate a given IP

$service = new Zend_Service_DeveloperGarden_IpLocation($config);
$service->setEnvironment(
    Zend_Service_DeveloperGarden_IpLocation::ENV_MOCK
);
$ip = new Zend_Service_DeveloperGarden_IpLocation_IpAddress('127.0.0.1');
print_r($service->locateIp($ip));

Local Search

The Local Search service provides the location based search machine » suchen.de via web service interface. For more details, refer to » the documentation.

Example #6 Locate a Restaurant

$service = new Zend_Service_DeveloperGarden_LocalSearch($config);
$search  = new Zend_Service_DeveloperGarden_LocalSearch_SearchParameters();
/**
 * @see http://www.developergarden.com/static/docu/en/ch04s02s06s04.html
 */
$search->setWhat('pizza')
       ->setWhere('jena');
print_r($service->localSearch($search));

Send SMS

The Send SMS service is used to send normal and Flash SMS to any number.

The following restrictions apply to the use of the SMS service:

  • An SMS or Flash SMS in the production environment must not be longer than 765 characters and must not be sent to more than 10 recipients.

  • An SMS or Flash SMS in the sandbox environment is shortened and enhanced by a note from the DeveloperGarden. The maximum length of the message is 160 characters.

  • In the sandbox environment, a maximum of 10 SMS can be sent per day.

  • The following characters are counted twice: | ^ € { } [ ] ~ \ LF (line break)

  • If a SMS or Flash SMS is longer than 160 characters, one message is charged for each 153 characters (quota and credit).

  • Delivery cannot be guaranteed for SMS or Flash SMS to landline numbers.

  • The sender can be a maximum of 11 characters. Permitted characters are letters and numbers.

  • The specification of a phone number as the sender is only permitted if the phone number has been validated. (See: SMS Validation)

Example #7 Sending an SMS

$service = new Zend_Service_DeveloperGarden_SendSms($config);
$sms = $service->createSms(
    '+49-172-123456; +49-177-789012',
    'your test message',
    'yourname'
);
print_r($service->send($sms));

SMS Validation

The SMS Validation service allows the validation of physical phone number to be used as the sender of an SMS.

First, call setValidationKeyword() to receive an SMS with a keyword.

After you get your keyword, you have to use the validate() to validate your number with the keyword against the service.

With the method getValidatedNumbers(), you will get a list of all already validated numbers and the status of each.

Example #8 Request validation keyword

$service = new Zend_Service_DeveloperGarden_SmsValidation($config);
print_r($service->sendValidationKeyword('+49-172-123456'));

Example #9 Validate a number with a keyword

$service = new Zend_Service_DeveloperGarden_SmsValidation($config);
print_r($service->validate('TheKeyWord', '+49-172-123456'));

To invalidate a validated number, call the method inValidate().

Voice Call

The Voice Call service can be used to set up a voice connection between two telephone connections. For specific details please read the » API Documentation.

Normally the Service works as followed:

  • Call the first participant.

  • If the connection is successful, call the second participant.

  • If second participant connects succesfully, both participants are connected.

  • The call is open until one of the participants hangs up or the expire mechanism intercepts.

Example #10 Call two numbers

$service = new Zend_Service_DeveloperGarden_VoiceCall($config);
$aNumber = '+49-30-000001';
$bNumber = '+49-30-000002';
$expiration  = 30;  // seconds
$maxDuration = 300; // 5 mins
$newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);
echo $newCall->getSessionId();

If the call is initiated, you can ask the result object for the session ID and use this session ID for an additional call to the callStatus or tearDownCall() methods. The second parameter on the callStatus() method call extends the expiration for this call.

Example #11 Call two numbers, ask for status, and cancel

$service = new Zend_Service_DeveloperGarden_VoiceCall($config);
$aNumber = '+49-30-000001';
$bNumber = '+49-30-000002';
$expiration  = 30; // seconds
$maxDuration = 300; // 5 mins

$newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);

$sessionId = $newCall->getSessionId();

$service->callStatus($sessionId, true); // extend the call

sleep(10); // sleep 10s and then tearDown

$service->tearDownCall($sessionId);

ConferenceCall

Conference Call allows you to setup and start a phone conference.

The following features are available:

  • Conferences with an immediate start

  • Conferences with a defined start date

  • Recurring conference series

  • Adding, removing, and muting of participants from a conference

  • Templates for conferences

Here is a list of currently implemented API methods:

  • createConference() creates a new conference

  • updateConference() updates an existing conference

  • commitConference() saves the conference, and, if no date is configured, immediately starts the conference

  • removeConference() removes a conference

  • getConferenceList() returns a list of all configured conferences

  • getConferenceStatus() displays information for an existing conference

  • getParticipantStatus() displays status information about a conference participant

  • newParticipant() creates a new participant

  • addParticipant() adds a participant to a conference

  • updateParticipant() updates a participant, usually to mute or redial the participant

  • removeParticipant() removes a participant from a conference

  • getRunningConference() requests the running instance of a planned conference

  • createConferenceTemplate() creates a new conference template

  • getConferenceTemplate() requests an existing conference template

  • updateConferenceTemplate() updates existing conference template details

  • removeConferenceTemplate() removes a conference template

  • getConferenceTemplateList() requests all conference templates of an owner

  • addConferenceTemplateParticipant() adds a conference participant to conference template

  • getConferenceTemplateParticipant() displays details of a participant of a conference template

  • updateConferenceTemplateParticipant() updates participant details within a conference template

  • removeConferenceTemplateParticipant() removes a participant from a conference template

Example #12 Ad-Hoc conference

$client = new Zend_Service_DeveloperGarden_ConferenceCall($config);

$conferenceDetails =
    new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail(
        'Zend-Conference',                    // name for the conference
        'this is my private zend conference', // description
        60                                    // duration in seconds
    );

$conference = $client->createConference('MyName', $conferenceDetails);

$part1 = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail(
    'Jon',
    'Doe',
    '+49-123-4321',
    'your.name@example.com',
    true
);

$client->newParticipant($conference->getConferenceId(), $part1);
// add a second, third ... participant

$client->commitConference($conference->getConferenceId());

Performance and Caching

You can setup various caching options to improve the performance for resolving WSDL and authentication tokens.

First of all, you can setup the internal SoapClient (PHP) caching values.

Example #13 WSDL cache options

Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setWsdlCache(
    [PHP CONSTANT]
);

The [PHP CONSTANT] can be one of the following values:

  • WSDL_CACHE_DISC: enabled disc caching

  • WSDL_CACHE_MEMORY: enabled memory caching

  • WSDL_CACHE_BOTH: enabled disc and memory caching

  • WSDL_CACHE_NONE: disabled both caching

If you also want to cache the result for calls to the SecuritTokenServer you can setup a Zend_Cache instance and pass it to the setCache().

Example #14 SecurityTokenServer cache option

$cache = Zend_Cache::factory('Core', ...);
Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setCache($cache);
Previous Next
Introdução ao Zend Framework
Resumo
Instalação
Conhecendo o Zend Framework
Guia Rápido do Zend Framework
Zend Framework & MVC Introduction
Create Your Project
Create A Layout
Create a Model and Database Table
Create A Form
Congratulations!
Auto-carregamento no Zend Framework
Introduction
Goals and Design
Basic Autoloader Usage
Resource Autoloading
Conclusion
Plugins no Zend Framework
Introduction
Using Plugins
Conclusion
Iniciando com o Zend_Layout
Introduction
Using Zend_Layout
Zend_Layout: Conclusions
Iniciando com os Marcadores do Zend_View
Introduction
Basic Placeholder Usage
Standard Placeholders
View Placeholders: Conclusion
Entendendo e Usando os Decoradores do Zend Form
Introduction
Decorator Basics
Layering Decorators
Rendering Individual Decorators
Creating and Rendering Composite Elements
Conclusion
Iniciando com o Zend_Session, Zend_Auth, e Zend_Acl
Building Multi-User Applications With Zend Framework
Managing User Sessions In ZF
Authenticating Users in Zend Framework
Building an Authorization System in Zend Framework
Iniciando com o Zend_Search_Lucene
Zend_Search_Lucene Introduction
Lucene Index Structure
Index Opening and Creation
Indexing
Searching
Supported queries
Search result pagination
Iniciando com o Zend_Paginator
Introduction
Simple Examples
Pagination Control and ScrollingStyles
Putting it all Together
Referência do Zend Framework
Zend_Acl
Introduction
Refining Access Controls
Advanced Usage
Zend_Amf
Introdução
Zend_Amf_Server
Zend_Application
Introdução
Zend_Application Quick Start
Theory of Operation
Examples
Core Functionality
Available Resource Plugins
Zend_Auth
Introduction
Database Table Authentication
Digest Authentication
HTTP Authentication Adapter
LDAP Authentication
Open ID Authentication
Zend_Barcode
Introdução
Criação de código de barras usando a classe Zend_Barcode
Objetos Zend_Barcode
Renderizadores do Zend_Barcode
Zend_Cache
Introduction
The Theory of Caching
Zend_Cache Frontends
Zend_Cache Backends
The Cache Manager
Zend_Captcha
Introdução
Captcha Operation
CAPTCHA Adapters
Zend_CodeGenerator
Introduction
Zend_CodeGenerator Examples
Zend_CodeGenerator Reference
Zend_Config
Introdução
Teoria de Operação
Zend_Config_Ini
Zend_Config_Xml
Zend_Config_Writer
Zend_Config_Writer
Zend_Console_Getopt
Introduction
Declaring Getopt Rules
Fetching Options and Arguments
Configuring Zend_Console_Getopt
Zend_Controller
Guia de Início Rápido do Zend_Controller
O Básico de Zend_Controller
O Front Controller
The Request Object
The Standard Router
The Dispatcher
Action Controllers
Action Helpers
The Response Object
Plugins
Using a Conventional Modular Directory Structure
MVC Exceptions
Zend_Currency
Introduction to Zend_Currency
Using Zend_Currency
Options for currencies
What makes a currency?
Where is the currency?
How does the currency look like?
How much is my currency?
Calculating with currencies
Exchanging currencies
Additional informations on Zend_Currency
Zend_Date
Introduction
Theory of Operation
Basic Methods
Zend_Date API Overview
Creation of Dates
Constants for General Date Functions
Working Examples
Zend_Db
Zend_Db_Adapter
Zend_Db_Statement
Zend_Db_Profiler
Zend_Db_Select
Zend_Db_Table
Zend_Db_Table_Row
Zend_Db_Table_Rowset
Zend_Db_Table Relationships
Zend_Db_Table_Definition
Zend_Debug
Dumping Variables
Zend_Dojo
Introduction
Zend_Dojo_Data: dojo.data Envelopes
Dojo View Helpers
Dojo Form Elements and Decorators
Zend_Dojo build layer support
Zend_Dom
Introdução
Zend_Dom_Query
Zend_Exception
Usando as Exceções
Uso básico
Exceções Anteriores
Zend_Feed
Introduction
Importing Feeds
Retrieving Feeds from Web Pages
Consuming an RSS Feed
Consuming an Atom Feed
Consuming a Single Atom Entry
Modifying Feed and Entry structures
Custom Feed and Entry Classes
Zend_Feed_Reader
Zend_Feed_Writer
Zend_Feed_Pubsubhubbub
Zend_File
Zend_File_Transfer
Validators for Zend_File_Transfer
Filters for Zend_File_Transfer
Zend_Filter
Introduction
Standard Filter Classes
Filter Chains
Writing Filters
Zend_Filter_Input
Zend_Filter_Inflector
Zend_Form
Zend_Form
Zend_Form Quick Start
Creating Form Elements Using Zend_Form_Element
Creating Forms Using Zend_Form
Creating Custom Form Markup Using Zend_Form_Decorator
Standard Form Elements Shipped With Zend Framework
Standard Form Decorators Shipped With Zend Framework
Internationalization of Zend_Form
Advanced Zend_Form Usage
Zend_Gdata
Introduction
Authenticating with AuthSub
Using the Book Search Data API
Authenticating with ClientLogin
Using Google Calendar
Using Google Documents List Data API
Using Google Health
Using Google Spreadsheets
Using Google Apps Provisioning
Using Google Base
Using Picasa Web Albums
Using the YouTube Data API
Catching Gdata Exceptions
Zend_Http
Introduction
Zend_Http_Client - Advanced Usage
Zend_Http_Client - Connection Adapters
Zend_Http_Cookie and Zend_Http_CookieJar
Zend_Http_Response
Zend_InfoCard
Introduction
Zend_Json
Introdução
Uso Básico
Uso Avançado do Zend_Json
Conversão de XML para JSON
Zend_Json_Server - JSON-RPC server
Zend_Layout
Introdução
Guia Rápido Zend_Layout
Opções de Configuração Zend_Layout
Uso Avançado de Zend_Layout
Zend_Ldap
Introduction
API overview
Usage Scenarios
Tools
Object oriented access to the LDAP tree using Zend_Ldap_Node
Getting information from the LDAP server
Serializing LDAP data to and from LDIF
Zend_Loader
Loading Files and Classes Dynamically
The Autoloader
Resource Autoloaders
Loading Plugins
Zend_Locale
Introduction
Using Zend_Locale
Normalization and Localization
Working with Dates and Times
Supported locales
Zend_Log
Overview
Writers
Formatters
Filters
Using the Factory to Create a Log
Zend_Mail
Introduction
Sending via SMTP
Sending Multiple Mails per SMTP Connection
Using Different Transports
HTML E-Mail
Attachments
Adding Recipients
Controlling the MIME Boundary
Additional Headers
Character Sets
Encoding
SMTP Authentication
Securing SMTP Transport
Reading Mail Messages
Zend_Markup
Introduction
Getting Started With Zend_Markup
Zend_Markup Parsers
Zend_Markup Renderers
Zend_Measure
Introduction
Creation of Measurements
Outputting measurements
Manipulating Measurements
Types of measurements
Zend_Memory
Overview
Memory Manager
Memory Objects
Zend_Mime
Zend_Mime
Zend_Mime_Message
Zend_Mime_Part
Zend_Navigation
Introduction
Pages
Containers
Zend_Oauth
Introduction to OAuth
Zend_OpenId
Introduction
Zend_OpenId_Consumer Basics
Zend_OpenId_Provider
Zend_Paginator
Introdução
Usage
Configuração
Advanced usage
Zend_Pdf
Introdução.
Criando e Carregando documentos PDF.
Salvar mudanças no documento PDF.
Document pages.
Drawing.
Interactive Features
Informação do Documento e Metadados.
Zend_Pdf module usage example
Zend_ProgressBar
Zend_ProgressBar
Zend_Queue
Introduction
Example usage
Framework
Adapters
Customizing Zend_Queue
Stomp
Zend_Reflection
Introduction
Zend_Reflection Examples
Zend_Reflection Reference
Zend_Registry
Using the Registry
Zend_Rest
Introduction
Zend_Rest_Client
Zend_Rest_Server
Zend_Search_Lucene
Resumo
Construindo Índices
Pesquisando em um Índice
Query Language
Tipos de Consulta
Conjuntos de Caracteres
Extensibilidade
Interoperando com Java Lucene
Advanced
Best Practices
Zend_Serializer
Introduction
Zend_Serializer_Adapter
Zend_Server
Introdução
Zend_Server_Reflection
Zend_Service
Introdução
Zend_Service_Akismet
Zend_Service_Amazon
Zend_Service_Amazon_Ec2
Zend_Service_Amazon_Ec2: Instances
Zend_Service_Amazon_Ec2: Windows Instances
Zend_Service_Amazon_Ec2: Reserved Instances
Zend_Service_Amazon_Ec2: CloudWatch Monitoring
Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)
Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)
Zend_Service_Amazon_Ec2: Elastic IP Addresses
Zend_Service_Amazon_Ec2: Keypairs
Zend_Service_Amazon_Ec2: Regions and Availability Zones
Zend_Service_Amazon_Ec2: Security Groups
Zend_Service_Amazon_S3
Zend_Service_Amazon_Sqs
Zend_Service_Audioscrobbler
Zend_Service_Delicious
Zend_Service_DeveloperGarden
Zend_Service_Flickr
Zend_Service_LiveDocx
Zend_Service_Nirvanix
Zend_Service_ReCaptcha
Zend_Service_Simpy
Zend_Service_SlideShare
Zend_Service_StrikeIron
Zend_Service_StrikeIron: Bundled Services
Zend_Service_StrikeIron: Advanced Uses
Zend_Service_Technorati
Zend_Service_Twitter
Zend_Service_WindowsAzure
Zend_Service_Yahoo
Zend_Session
Introduction
Basic Usage
Advanced Usage
Global Session Management
Zend_Session_SaveHandler_DbTable
Zend_Soap
Zend_Soap_Server
Zend_Soap_Client
WSDL Accessor
AutoDiscovery
Zend_Tag
Introduction
Zend_Tag_Cloud
Zend_Test
Introdução
Zend_Test_PHPUnit
Zend_Test_PHPUnit_Db
Zend_Text
Zend_Text_Figlet
Zend_Text_Table
Zend_TimeSync
Introduction
Working with Zend_TimeSync
Zend_Tool
Using Zend_Tool On The Command Line
Extending Zend_Tool
Zend_Tool_Framework
Introduction
Using the CLI Tool
Architecture
Creating Providers to use with Zend_Tool_Framework
Shipped System Providers
Extending and Configuring Zend_Tool_Framework
Zend_Tool_Project
Introduction
Create A Project
Zend_Tool Project Providers
Zend_Tool_Project Internals
Zend_Translate
Introduction
Adapters for Zend_Translate
Using Translation Adapters
Creating source files
Additional features for translation
Plural notations for Translation
Zend_Uri
Zend_Uri
Zend_Validate
Introduction
Standard Validation Classes
Validator Chains
Writing Validators
Validation Messages
Zend_Version
Obtendo a Versão do Zend Framework
Zend_View
Introdução
Scripts Controladores
Scripts de Visualização
Assistentes de Visualização (Modificadores)
Zend_View_Abstract
Zend_Wildfire
Zend_Wildfire
Zend_XmlRpc
Introduction
Zend_XmlRpc_Client
Zend_XmlRpc_Server
ZendX_Console_Process_Unix
ZendX_Console_Process_Unix
ZendX_JQuery
Introduction
ZendX_JQuery View Helpers
ZendX_JQuery Form Elements and Decorators
Pré-requisitos do Zend Framework
Introdução
Notas de Migração do Zend Framework
Zend Framework 1.10
Zend Framework 1.9
Zend Framework 1.8
Zend Framework 1.7
Zend Framework 1.6
Zend Framework 1.5
Zend Framework 1.0
Zend Framework 0.9
Zend Framework 0.8
Zend Framework 0.6
Padrões de Codificação do Framework Zend para PHP
Visão Geral
Formato do Arquivo PHP
Convenções de Nomes
Estilo de Código
Zend Framework Documentation Standard
Overview
Documentation File Formatting
Recommendations
Recommended Project Structure for Zend Framework MVC Applications
Overview
Recommended Project Directory Structure
Module Structure
Rewrite Configuration Guide
Guia de Desempenho do Zend Framework
Introdução
Class Loading
Zend_Db Performance
Internationalization (i18n) and Localization (l10n)
View Rendering
Informações Sobre Direitos Autorais