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 ZendService\DeveloperGarden\DeveloperGarden components provides a clean and simple interface to the Developer Garden APIs and additionally offers functionality to improve handling and performance.
The backend SOAP API is documented here.
Before you can start using the DeveloperGarden API, you first have to sign up for an account.
With the DeveloperGarden API you have the possibility to choose between 3 different development environments.
For every environment and service, there are some special features (options) available for testing. Please look here for details.
You can pass to all classes an array of configuration values. Possible values are:
Configuration Example
1 2 3 4 5 6 7 | require_once 'ZendService/DeveloperGarden/SendSms.php';
$config = array(
'username' => 'yourUsername',
'password' => 'yourPassword',
'environment' => ZendService\DeveloperGarden\SendSms::ENV_PRODUCTION,
);
$service = new ZendService\DeveloperGarden\SendSms($config);
|
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).
Get account balance example
1 2 | $service = new ZendService\DeveloperGarden\BaseUserService($config);
print_r($service->getAccountBalance());
|
You can fetch quota informations for a specific service module with the provided methods.
Get quota information example
1 2 3 4 5 6 7 8 | $service = new ZendService\DeveloperGarden\BaseUserService($config);
$result = $service->getSmsQuotaInformation(
ZendService\DeveloperGarden\BaseUserService::ENV_PRODUCTION
);
echo 'Sms Quota:<br />';
echo 'Max Quota: ', $result->getMaxQuota(), '<br />';
echo 'Max User Quota: ', $result->getMaxUserQuota(), '<br />';
echo 'Quota Level: ', $result->getQuotaLevel(), '<br />';
|
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:
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.
Change quota information example
1 2 3 4 5 6 7 8 | $service = new ZendService\DeveloperGarden\BaseUserService($config);
$result = $service->changeSmsQuotaPool(
1000,
ZendService\DeveloperGarden\BaseUserService::ENV_PRODUCTION
);
if (!$result->hasError()) {
echo 'updated Quota Pool';
}
|
Here a list of all changeQuotaPool methods:
This service allows you to retrieve location information for a given IP address.
There are some limitations:
Locate a given IP
1 2 3 4 5 6 | $service = new ZendService\DeveloperGarden\IpLocation($config);
$service->setEnvironment(
ZendService\DeveloperGarden\IpLocation::ENV_MOCK
);
$ip = new ZendService\DeveloperGarden\IpLocation\IpAddress('127.0.0.1');
print_r($service->locateIp($ip));
|
The Local Search service provides the location based search machine suchen.de via web service interface. For more details, refer to the documentation.
Locate a Restaurant
1 2 3 4 5 6 7 8 | $service = new ZendService\DeveloperGarden\LocalSearch($config);
$search = new ZendService\DeveloperGarden\LocalSearch\SearchParameters();
/**
* @see http://www.developergarden.com/static/docu/en/ch04s02s06s04.html
*/
$search->setWhat('pizza')
->setWhere('jena');
print_r($service->localSearch($search));
|
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:
Sending an SMS
1 2 3 4 5 6 7 | $service = new ZendService\DeveloperGarden\SendSms($config);
$sms = $service->createSms(
'+49-172-123456; +49-177-789012',
'your test message',
'yourname'
);
print_r($service->send($sms));
|
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.
Request validation keyword
1 2 | $service = new ZendService\DeveloperGarden\SmsValidation($config);
print_r($service->sendValidationKeyword('+49-172-123456'));
|
Validate a number with a keyword
1 2 | $service = new ZendService\DeveloperGarden\SmsValidation($config);
print_r($service->validate('TheKeyWord', '+49-172-123456'));
|
To invalidate a validated number, call the method inValidate().
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 two numbers
1 2 3 4 5 6 7 | $service = new ZendService\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.
Call two numbers, ask for status, and cancel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $service = new ZendService\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);
|
Conference Call allows you to setup and start a phone conference.
The following features are available:
Here is a list of currently implemented API methods:
Ad-Hoc conference
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | $client = new ZendService\DeveloperGarden\ConferenceCall($config);
$conferenceDetails =
new ZendService\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 ZendService\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());
|
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.
WSDL cache options
1 2 3 | ZendService\DeveloperGarden\SecurityTokenServer\Cache::setWsdlCache(
[PHP CONSTANT]
);
|
The [PHP CONSTANT] can be one of the following values:
If you also want to cache the result for calls to the SecurityTokenServer you can setup a Zend_Cache instance and pass it to the setCache().
SecurityTokenServer cache option
1 2 | $cache = Zend_Cache::factory('Core', ...);
ZendService\DeveloperGarden\SecurityTokenServer\Cache::setCache($cache);
|
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.