Thursday, May 9, 2013

Wild West Domain (WWD) API Integration for php - Domain name registration - Step 2


Wild West Domain (WWD) API Integration for php

I am now just completed the 7 steps for the wild west domain (API) certification and I faced a lot of issues and spent too much time for completing it. Anyway I think it is the best to not check the below codes because when we try to do it our self, we will get a good idea about the working of it.. But in some places there is very much helpless and lose full control. In that time, I think you may use this..

The following are the tutorials: 


From the following link, we will get all available methods using in API

https://api.wildwestdomains.com/wswwdapi/wapi.asmx

Please keep the results in a notepad as it contains information for the next steps

Step 2


Domain name registration



function orderDomains(){ $cltrid = $this->guid(); $dsc_header = array("POST /wswwdapi/wapi.asmx HTTP/1.1", "Host: api.ote.wildwestdomains.com", "Content-Type: text/xml; charset=utf-8", "SOAPAction: \"http://wildwestdomains.com/webservices/OrderDomains\"" ); $dsc_msg = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <OrderDomains xmlns="http://wildwestdomains.com/webservices/"> <sCLTRID>'.$cltrid.'</sCLTRID> <credential> <Account>sdfgsdfg</Account> <Password>sdgfdfg</Password> </credential> <shopper> <acceptOrderTOS>agree</acceptOrderTOS> <user>createNew</user> <pwd>abcde</pwd> <pwdhint>ccc pass</pwdhint> <email>agordon@wildwestdomains.com</email> <firstname>Artemus</firstname> <lastname>Gordon</lastname> <phone>(888) 555-1212</phone> <pin>1234</pin> </shopper> <items> <DomainRegistration> <order> <productid>350077</productid> <quantity>1</quantity> <riid></riid> <duration>1</duration> </order> <sld>example</sld> <tld>biz</tld> <idnScript></idnScript> <period>2</period> <registrant> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </registrant> <nsArray> <NS> <name>ns1.example.com</name> </NS> <NS> <name>ns2.example.com</name> </NS> </nsArray> <admin> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </admin> <billing> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </billing> <tech> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </tech> <autorenewflag>1</autorenewflag> </DomainRegistration> <DomainRegistration> <order> <productid>350127</productid> <quantity>1</quantity> <duration>1</duration> </order> <sld>example</sld> <tld>us</tld> <idnScript></idnScript> <period>2</period> <registrant> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </registrant> <nexus> <category>citizen of US</category> <use>personal</use> <country>US</country> </nexus> <nsArray> <NS> <name>ns1.example.com</name> </NS> <NS> <name>ns2.example.com</name> </NS> </nsArray> <admin> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </admin> <billing> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </billing> <tech> <fname>Artemus</fname> <lname>Gordon</lname> <org></org> <email>agordon@wildwestdomains.com</email> <sa1>2 N. Main St.</sa1> <sa2></sa2> <city>Valdosta</city> <sp>Georgia</sp> <pc>17123</pc> <cc>United States</cc> <phone>(888) 555-1212</phone> <fax></fax> </tech> <autorenewflag>1</autorenewflag> </DomainRegistration> </items> <sROID></sROID> </OrderDomains> </soap:Body> </soap:Envelope>'; echo $dsc_msg; $ch = curl_init("https://api.ote.wildwestdomains.com/wswwdapi/wapi.asmx?WSDL"); if ($ch == FALSE) { echo "Connecting to createsend failed\n"; } curl_setopt($ch,CURLOPT_HTTPHEADER, $dsc_header); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_POSTFIELDS, $dsc_msg); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch,CURLOPT_VERBOSE, 0); $result = curl_exec($ch); $xml = simplexml_load_string($dsc_msg); echo "Return XML:\n$result\n"; }



function guid(){
if (function_exists('com_create_guid')){
return com_create_guid();
}else{
mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
$charid = strtoupper(md5(uniqid(rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12)
.chr(125);// "}"
return $uuid;
}
}


No comments:

Post a Comment