hello,
meaby some 1 can show example of creating custom registrar module wich 1 contacting registrar trough epp?
for example my xml codes:
$hello = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<hello/>
</epp>";
$jungiam = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<login>
<clID>RG000339</clID>
<pw>xxxxxx</pw>
<options>
<version>1.0</version>
<lang>lt</lang>
</options>
<svcs>
<objURI>http://www.domreg.lt/epp/xml/domreg-domain-1.0</objURI>
</svcs>
</login>
<clTRID>abc123</clTRID>
</command>
</epp>";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<transfer op=\"request\">
<domain:transfer
xmlns:domain=\"http://www.domreg.lt/epp/xml/domreg-domain-1.0\">
<domain:name>ote-test-337fff7cd75b.lt</domain:name>
<domain:trType>trade</domain:trType>
<domain:registrant>RN8603</domain:registrant>
<domain:contact>CN2173</domain:contact>
</domain:transfer>
</transfer>
<clTRID>TRADE-11213</clTRID>
</command>
</epp>";
$atsijungiam = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<logout/>
<clTRID>ABC-12345</clTRID>
</command>
</epp>";
cab some 1 show an example integrating this xml codes into custom registrar module: http://docs.whmcs.com/Creating_Modules
i dont need for transfer command, i need to create all module and that transfer command was an example.
there is few more xml codes that was required when i was making registrar test:
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\">
<command>
<create>
<contact:create xmlns:contact=\"http://www.domreg.lt/epp/xml/domreg-contact-1.0\"> <contact:postalInfo type=\"loc\">
<contact:name>Test registrant</contact:name>
<contact:org>UAB \"Test & test\"</contact:org>
<contact:addr>
<contact:street>Test street 123</contact:street>
<contact:city>TestCity</contact:city>
<contact:pc>12345</contact:pc>
<contact:cc>lt</contact:cc>
</contact:addr>
</contact:postalInfo>
<contact:voice>+370.37300000</contact:voice>
<contact:fax>+370.37300001</contact:fax>
<contact:email>valakampiai@bamba.lt</contact:email>
<contact:role>registrant</contact:role>
</contact:create>
</create>
<clTRID>client-111</clTRID>
</command>
</epp>";
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\">
<command>
<create>
<contact:create xmlns:contact=\"http://www.domreg.lt/epp/xml/domreg-contact-1.0\"> <contact:postalInfo type=\"loc\">
<contact:name>Tech admin</contact:name>
<contact:addr>
<contact:street>Test gatvė 1232</contact:street>
<contact:city>AdminCity</contact:city>
<contact:pc>12345</contact:pc>
<contact:cc>lt</contact:cc>
</contact:addr>
</contact:postalInfo>
<contact:voice>+370.37300000</contact:voice>
<contact:fax>+370.37300001</contact:fax>
<contact:email>valakampiai@bamba.lt</contact:email>
<contact:role>tech</contact:role>
</contact:create>
</create>
<clTRID>client-111</clTRID>
</command>
</epp>";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\">
<command>
<info>
<contact:info
xmlns:contact=\"http://www.domreg.lt/epp/xml/domreg-contact-1.0\">
<contact:id>CN2171</contact:id>
</contact:info>
</info>
</command>
</epp>";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<check>
<domain:check
xmlns:domain=\"http://www.domreg.lt/epp/xml/domreg-domain-1.0\">
<domain:name>ote-test-337fff7cd75b.lt</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<create>
<domain:create
xmlns:domain=\"http://www.domreg.lt/epp/xml/domreg-domain-1.0\">
<domain:name>ote-test-337fff7cd75b.lt</domain:name>
<domain:onExpire>delete</domain:onExpire>
<domain:registrant>RN8599</domain:registrant>
<domain:contact>CN2171</domain:contact>
</domain:create>
</create>
<clTRID>NEWDOMAIN-0001</clTRID>
</command>
</epp>";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<update>
<domain:update
xmlns:domain=\"http://www.domreg.lt/epp/xml/domreg-domain-1.0\">
<domain:name>ote-test-337fff7cd75b.lt</domain:name>
<domain:add>
<domain:ns>
<domain:hostAttr>
<domain:hostName>ns1.ote-test-337fff7cd75b.lt</domain:hostName>
<domain:hostAddr ip=\"v4\">83.171.8.20</domain:hostAddr>
<domain:hostAddr ip=\"v6\">2001:778:0:8::20</domain:hostAddr>
</domain:hostAttr>
<domain:hostAttr>
<domain:hostName>ns2.ote-test-337fff7cd75b.lt</domain:hostName>
<domain:hostAddr ip=\"v4\">83.171.8.21</domain:hostAddr>
<domain:hostAddr ip=\"v6\">2001:778:0:8::21</domain:hostAddr>
</domain:hostAttr>
<domain:hostAttr>
<domain:hostName>ns2.domreg.lt</domain:hostName>
</domain:hostAttr>
</domain:ns>
</domain:add>
<domain:chg>
<domain:onExpire>renew</domain:onExpire>
</domain:chg>
</domain:update>
</update>
</command>
</epp>";
and so on... all default xml codes.
in test i was executing commands with defoult php script
<?php
//============================================
function mod ($a, $b)
{
return $a % $b;
}
//============================================
class EppSocket {
var $fp = null;
function EppSocket()
{
}
function connect($addr, $port, $timeout)
{
$this->fp = fsockopen ($addr, $port , $errno, $errstr, $timeout);
return 0;
}
function readInteger()
{
$buf = fread($this->fp, 4);
if (strlen($buf) < 4)
{
echo "failed to read 4 bytes \n";
exit;
}
$b0 = ord($buf[0]);
$b1 = ord($buf[1]);
$b2 = ord($buf[2]);
$b3 = ord($buf[3]);
$value = $b3 + 256* ($b2 + 256* ($b1 + 256* $b0));
echo "integer read from socket: $value \n";
return $value;
}
function readString ($bytes)
{
echo "waiting for $bytes bytes\n";
$left = $bytes;
$data = '';
while ( !feof($this->fp) ) {
$chunk = fread($this->fp, $left);
$data .= $chunk;
$left = $left - strlen($chunk);
if ($left == 0)
break;
}
return $data;
}
function readEppString()
{
$len = $this->readInteger();
$len = $len - 4;
return $this->readString ($len);
}
function close()
{
fclose ($this->fp);
}
// this will fail for values bigger than 0x7FFFFFFF (since PHP sucks at math)
// on Windows: PHP thinks that 0xFFFFFFFE modulo 256 = 256 !?!
// on Linux : PHP thinks that 0xFFFFFFFE modulo 256 = -2 !?!
function writeInteger ($value)
{
$b3 = mod ($value, 256);
$value = ($value - $b3)/256;
$b2 = mod ($value, 256);
$value = ($value - $b2)/256;
$b1 = mod ($value, 256);
$value = ($value - $b1)/256;
$b0 = mod ($value, 256);
echo "$value split up in bytes : $b0 $b1 $b2 $b3 \n";
fwrite ($this->fp, chr($b0), 1);
fwrite ($this->fp, chr($b1), 1);
fwrite ($this->fp, chr($b2), 1);
fwrite ($this->fp, chr($b3), 1);
}
function writeEppString ($message)
{
$len = strlen ($message);
echo "len: $len \n";
$len = $len + 4;
echo "total message length: $len bytes \n";
$this->writeInteger ($len);
echo "writing message itself \n";
$written = fwrite ($this->fp, $message);
echo "bytes written: $written \n";
}
}
//=====================================================
{
$socket = new EppSocket();
$server = "ssl://epp.test.domreg.lt"; // replace with hostname of your registry's epp server
$port = 700;
$timeout = 30;
$ok = $socket->connect ($server, $port, $timeout);
if ( $ok != 0)
{
echo "failed to connect to $server, check server name !!";
exit;
}
echo "ok, connected to $server at port $port\n";
$greeting = $socket->readEppString();
echo "=====================\n";
echo "$greeting ";
echo "=====================\n";
$hello = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<hello/>
</epp>";
$socket->writeEppString ($hello);
echo "waiting for reply \n";
$response = $socket->readEppString();
echo "=====================\n";
echo "$response ";
echo "=====================\n";
$jungiam = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<login>
<clID>RG000339</clID>
<pw>xxxxxx</pw>
<options>
<version>1.0</version>
<lang>lt</lang>
</options>
<svcs>
<objURI>http://www.domreg.lt/epp/xml/domreg-domain-1.0</objURI>
</svcs>
</login>
<clTRID>abc123</clTRID>
</command>
</epp>";
$socket->writeEppString ($jungiam);
echo "waiting for reply of jungiam \n";
$response = $socket->readEppString();
echo "=====================\n";
echo "$response ";
echo "=====================\n";
$kurimas = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<transfer op=\"request\">
<domain:transfer
xmlns:domain=\"http://www.domreg.lt/epp/xml/domreg-domain-1.0\">
<domain:name>ote-test-337fff7cd75b.lt</domain:name>
<domain:trType>trade</domain:trType>
<domain:registrant>RN8603</domain:registrant>
<domain:contact>CN2173</domain:contact>
</domain:transfer>
</transfer>
<clTRID>TRADE-11213</clTRID>
</command>
</epp>";
$socket->writeEppString ($kurimas);
echo "waiting for reply of jungiam \n";
$response = $socket->readEppString();
echo "=====================\n";
echo "$response ";
echo "=====================\n";
$atsijungiam = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<command>
<logout/>
<clTRID>ABC-12345</clTRID>
</command>
</epp>";
$socket->writeEppString ($atsijungiam);
echo "waiting for reply of jungiam \n";
$response = $socket->readEppString();
echo "=====================\n";
echo "$response ";
echo "=====================\n";
$socket->close();
}
?>
So, i dont know how to create custom module, so it would be great if some 1 could create example of http://docs.whmcs.com/Creating_Modules registrar only for few command would be great...
thanx for you time