public function testLoginServicesExtensions() { $frame = new Login(); $frame->setClientId('gunter'); $frame->setPassword('grodotzki'); $frame->setNewPassword('grodotzki2'); $frame->setVersion('1.0'); $frame->setLanguage('en'); $frame->addService('urn:ietf:params:xml:ns:domain-1.0'); $frame->addService('urn:ietf:params:xml:ns:contact-1.0'); $frame->addServiceExtension('http://drs.ua/epp/drs-1.0'); $frame->addServiceExtension('http://hostmaster.ua/epp/uaepp-1.1'); $this->assertXmlStringEqualsXmlString((string) $frame, '<?xml version="1.0" encoding="UTF-8" standalone="no"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <command> <login> <clID>gunter</clID> <pw>grodotzki</pw> <newPW>grodotzki2</newPW> <options> <version>1.0</version> <lang>en</lang> </options> <svcs> <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI> <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI> <svcExtension> <extURI>http://drs.ua/epp/drs-1.0</extURI> <extURI>http://hostmaster.ua/epp/uaepp-1.1</extURI> </svcExtension> </svcs> </login> </command> </epp>'); }
protected function login() { // send login command $login = new LoginCommand(); $login->setClientId($this->username); $login->setPassword($this->password); $login->setVersion('1.0'); $login->setLanguage('en'); if (!empty($this->services) && is_array($this->services)) { foreach ($this->services as $urn) { $login->addService($urn); } if (!empty($this->serviceExtensions) && is_array($this->serviceExtensions)) { foreach ($this->serviceExtensions as $extension) { $login->addServiceExtension($extension); } } } $response = $this->request($login); unset($login); // check if login was successful if (!$response instanceof ResponseFrame) { throw new Exception('there was a problem logging onto the EPP server'); } elseif ($response->code() !== 1000) { throw new Exception($response->message(), $response->code()); } }
<?php // debug error_reporting(E_ALL); ini_set('display_errors', true); chdir(__DIR__); require '../src/AfriCC/autoload.php'; use AfriCC\EPP\Frame\Command\Login; $frame = new Login(); $frame->setClientId('gunter'); $frame->setPassword('grodotzki'); $frame->setNewPassword('grodotzki2'); $frame->setVersion('1.0'); $frame->setLanguage('en'); $frame->addService('urn:ietf:params:xml:ns:domain-1.0'); $frame->addService('urn:ietf:params:xml:ns:contact-1.0'); $frame->addServiceExtension('http://drs.ua/epp/drs-1.0'); $frame->addServiceExtension('http://hostmaster.ua/epp/uaepp-1.1'); echo $frame;
<?php // debug error_reporting(E_ALL); ini_set('display_errors', true); chdir(__DIR__); require '../src/AfriCC/autoload.php'; use AfriCC\EPP\Frame\Command\Login; $frame = new Login(); $frame->setClientId('gunter'); $frame->setPassword('grodotzki'); $frame->setNewPassword('grodotzki2'); $frame->setVersion('1.0'); $frame->setLanguage('en'); $frame->addService('urn:ietf:params:xml:ns:domain-1.0'); $frame->addService('urn:ietf:params:xml:ns:contact-1.0'); echo $frame;