Thursday, May 9, 2013

Wild West Domain (WWD) API Integration for php - Process Request


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

Process Request


function ProcessRequest(){


$cltrid = 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/ProcessRequest\""
);

$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>
    <ProcessRequest xmlns="http://wildwestdomains.com/webservices/">
      <sRequestXML>'.htmlspecialchars('<wapi clTRID="'.$cltrid.'" account="sdfasdf"
pwd="asdfsd">
<manage>
<script cmd="reset"/>
</manage>
</wapi>').'
</sRequestXML>
    </ProcessRequest>
  </soap:Body>
</soap:Envelope>';

$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);
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;
}
}

Wild West Domain (WWD) API Integration for php - Domain name transfer - Step 7



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 7


Domain name transfer



function OrderDomainTransfers(){


$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/OrderDomainTransfers\""
);

$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>
    <OrderDomainTransfers xmlns="http://wildwestdomains.com/webservices/">
      <sCLTRID>'.$cltrid.'</sCLTRID>
      <credential>
        <Account>dfsgdfg</Account>
        <Password>sdfgsdfg</Password>
      </credential>
      <shopper>
        <acceptOrderTOS>agree</acceptOrderTOS>
        <user>createNew</user>
        <pwd>ghijk</pwd>
        <pwdhint>password hint</pwdhint>
        <email>joe@smith.us</email>
        <firstname>Joe</firstname>
        <lastname>Smith</lastname>
        <phone>(777)555-1212</phone>
        <pin>1234</pin>
      </shopper>
      <items>
        <DomainTransfer>
          <order>
            <productid>350011</productid>
            <parent_resource_id></parent_resource_id>
            <quantity>1</quantity>
            <riid></riid>
            <duration>1</duration>
          </order>
          <sld>example</sld>
          <tld>com</tld>
          <authInfo></authInfo>
          <idnScript></idnScript>
        </DomainTransfer>
      </items>
      <sROID></sROID>
    </OrderDomainTransfers>
  </soap:Body>
</soap:Envelope>';

$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);
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;
}
}


Wild West Domain (WWD) API Integration for php - Domain name availability check - step 1 & 4




Wild West Domain (WWD) API Integration for php - Domain name renewal - Step 6



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 6



Domain name renewal



function OrderPrivateDomainRenewals(){


$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/OrderPrivateDomainRenewals\""
);

$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>
    <OrderPrivateDomainRenewals xmlns="http://wildwestdomains.com/webservices/">
      <sCLTRID>'.$cltrid.'</sCLTRID>
      <credential>
        <Account>dfasdf</Account>
        <Password>sadfasd</Password>
      </credential>
      <shopper>
        <acceptOrderTOS>agree</acceptOrderTOS>
        <user>833655</user>  // this info will get from previous xml responses
        <dbpuser>833656</dbpuser>  // this info will get from previous xml responses
        <dbppwd>defgh</dbppwd>
      </shopper>
      <items>
        <DomainRenewal>
          <order>
            <productid>350087</productid>
            <parent_resource_id></parent_resource_id>
            <quantity>1</quantity>
            <riid></riid>
            <duration>1</duration>
          </order>
          <resourceid>domain:6402</resourceid>
          <sld>example</sld>
          <tld>biz</tld>
          <period>1</period>
        </DomainRenewal>
        <DomainRenewal>
          <order>
            <productid>350137</productid>
            <parent_resource_id></parent_resource_id>
            <quantity>1</quantity>
            <riid></riid>
            <duration>1</duration>
          </order>
          <resourceid>domain:6402</resourceid>
 // Please note that this resource id is the same resource id that is in above . In the xml response there is two resource ids.. but I think there is some problem.. The first resource id only working. If we put the second resource id here it is not working(but it looks like it need to work). So put the same resource id in both places.
          <sld>example</sld>
          <tld>us</tld>
          <period>1</period>
        </DomainRenewal>
      </items>
      <dbpItems>
        <ResourceRenewal>
          <order>
            <productid>387001</productid>
            <parent_resource_id></parent_resource_id>
            <quantity>1</quantity>
            <riid></riid>
            <duration>1</duration>
          </order>
          <resourceid>dbp:21815</resourceid> // will get from previous response xml
        </ResourceRenewal>
      </dbpItems>
      <sROID></sROID>
    </OrderPrivateDomainRenewals>
  </soap:Body>
</soap:Envelope>';

$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);
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;
}
}

Wild West Domain (WWD) API Integration for php -Domain name information query - STEP 5


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 5



Domain name information query



function Info(){


$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/Info\""
);

$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>
    <Info xmlns="http://wildwestdomains.com/webservices/">
      <sCLTRID>'.$cltrid.'</sCLTRID>
      <credential>
        <Account>dsfgsdfg</Account>
        <Password>sdfgsdfg</Password>
      </credential>
      <sResourceID>domain:6402</sResourceID> // this value will get from the previous response xmls
      <sType>standard</sType>
      <sDomain></sDomain>
      <sOrderID></sOrderID>
    </Info>
  </soap:Body>
</soap:Envelope>';


$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);
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;
}
}

Wild West Domain (WWD) API Integration for php - Domain name renewal - Step 6

Wild West Domain (WWD) API Integration for php - Domain name privacy purchase and Poll methods - step 3



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

Now the step 3


Domain name privacy purchase


function Poll(){


$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/Poll\""
);

$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>
    <Poll xmlns="http://wildwestdomains.com/webservices/">
      <sCLTRID>'.$cltrid.'</sCLTRID>
      <credential>
        <Account>dfgsdfg</Account>
        <Password>sdfgsdf</Password>
      </credential>
      <sOp>req</sOp>
    </Poll>
  </soap:Body>
</soap:Envelope>';

$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);
echo "Return XML:\n$result\n";

}

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


function OrderDomainPrivacy(){


$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/OrderDomainPrivacy\""
);

$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>
    <OrderDomainPrivacy xmlns="http://wildwestdomains.com/webservices/">
      <sCLTRID>'.$cltrid.'</sCLTRID>
      <credential>
        <Account>sdfsd</Account>
        <Password>sdfsdf</Password>
      </credential>
      <shopper>
        <acceptOrderTOS>agree</acceptOrderTOS>
        <user>833655</user>  // this user id will get from the orderDomain response xml
        <dbpuser>createNew</dbpuser>
        <dbppwd>defgh</dbppwd>
        <dbppwdhint>password hint</dbppwdhint>
        <dbpemail>info@example.biz</dbpemail>
        <dbppin>1234</dbppin>
      </shopper>
      <items>
        <DomainByProxy>
          <order>
            <productid>377001</productid>
            <parent_resource_id></parent_resource_id>
            <quantity>1</quantity>
            <riid></riid>
            <duration>2</duration>
          </order>
          <sld>example</sld>
          <tld>biz</tld>
          <resourceid>domain:6402</resourceid>
        </DomainByProxy>
     
      </items>
      <sROID></sROID>
    </OrderDomainPrivacy>
  </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);
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;
}
}


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;
}
}


Wild West Domain (WWD) API Integration for php - Domain name availability check - step 1 & 4

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


step 1 & 4

Domain name availability check



function checkAvailability(){

$cltrid = 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/CheckAvailability\""
);
$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>
<CheckAvailability xmlns="http://wildwestdomains.com/webservices/">
<sCLTRID>'.$cltrid.'</sCLTRID>
<credential>
<Account>dfgdsfg</Account>
<Password>dsfgdfg</Password>
</credential>
<sDomainArray>
<string>example.biz</string>
<string>example.us</string>
</sDomainArray>
<sHostArray>
<string></string>
<string></string>
</sHostArray>
<sNSArray>
<string></string>
<string></string>
</sNSArray>
</CheckAvailability>
</soap:Body>
</soap:Envelope>';

$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;
}
}



Thursday, April 25, 2013

SWF File uploader issue fixation in codeigniter - SWF DEBUG: Event: uploadError : IO Error : File ID: SWFUpload_0_0. IO Error: Error #2038

Codeigniter - SWF file uploader issue fixation.

I was spent too much time on fixing a issue of SWF uploader and simply fixed it after a long time.

I was getting the error like

SWF DEBUG: Event: uploadError : IO Error : File ID: SWFUpload_0_0. IO Error: Error #2038

And I fixed it by just changing

upload_url: "http://abc.com/order/uploadFiles",

TO

upload_url : "http://abc.com/index.php/order/uploadFiles",

now the whole function will be:


$(function(){
$('#swfupload-control').swfupload({
upload_url: "http://abc.com/index.php/order/uploadFiles",
file_post_name: 'uploadfile',
file_size_limit : "1024",
file_types : "*.csv",
file_types_description : "Image files",
file_upload_limit : 1,
flash_url : "<?=base_url()?>assets/swfupload/swfupload.swf",
button_image_url : '<?=base_url()?>assets/swfupload/XPButtonUploadText_61x22.png',
button_width : 114,
button_height : 20,
button_placeholder : $('#button')[0],
debug: true
})
.bind('fileQueued', function(event, file){
var listitem='<li id="'+file.id+'" >'+
'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
'<div class="progressbar" ><div class="progress" ></div></div>'+
'<p class="status" >Pending</p>'+
'<span class="cancel" >&nbsp;</span>'+
'</li>';
$('#log').append(listitem);
$('li#'+file.id+' .cancel').bind('click', function(){
var swfu = $.swfupload.getInstance('#swfupload-control');
swfu.cancelUpload(file.id);
$('li#'+file.id).slideUp('fast');
});
// start the upload since it's queued
$(this).swfupload('startUpload');
})
.bind('fileQueueError', function(event, file, errorCode, message){
alert('Size of the file '+file.name+' is greater than limit');
})
.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
$('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
})
.bind('uploadStart', function(event, file){
$('#log li#'+file.id).find('p.status').text('Uploading...');
$('#log li#'+file.id).find('span.progressvalue').text('0%');
$('#log li#'+file.id).find('span.cancel').hide();
})
.bind('uploadProgress', function(event, file, bytesLoaded){
//Show Progress

var percentage=Math.round((bytesLoaded/file.size)*100);
$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
})
.bind('uploadSuccess', function(event, file, serverData){
var item=$('#log li#'+file.id);
item.find('div.progress').css('width', '100%');
item.find('span.progressvalue').text('100%');
var pathtofile='<a href="uploads/'+file.name+'" target="_blank" >view &raquo;</a>';
item.addClass('success').find('p.status').html('Done!!! | '+pathtofile);
})
.bind('uploadComplete', function(event, file){
// upload has completed, try the next one in the queue
$(this).swfupload('startUpload');
})

});


Friday, April 19, 2013

working with json in codeigniter



  <?php
$attributes = array("id"=>"register_form");
echo form_open('register',$attributes); ?>
<div id="w4l-reg-name" class="control-group">
<div class="controls">
<input type="text" placeholder="Full Name" name="name">
<span class="help-inline"></span>
</div>
</div>

<div id="w4l-reg-number" class="control-group">
<div class="controls">
<input type="text" placeholder="Favorite Number" name="number">
<span class="help-inline" ></span>
</div>
</div>

<div id="w4l-reg-email" class="control-group">
<div class="controls">
<input type="text" placeholder="Email Address" name="email">
<span class="help-inline"></span>
</div>
</div>

<div id="w4l-reg-email2" class="control-group">
<div class="controls">
<input type="text" placeholder="Confirm Email Address" name="email2">
<span class="help-inline"></span>
</div>
</div>

<div id="w4l-reg-password" class="control-group">
<div class="controls">
<input type="password" placeholder="Password" name="password">
<span class="help-inline"></span>
</div>
</div>
<div id="w4l-reg-password2" class="control-group">
<div class="controls">
<input type="password" placeholder="Confirm Password" name="password2">
<span class="help-inline"></span>
</div>
</div>
       
      </div>
      <div class="modal-footer">
        <button type="button" onclick="memberRegister();" class="btn btn-danger">Sign Up</button>
        </form>
---------------------------------------------------------------------------------------------------------



function memberRegister(){
$.post(BASE_PATH+"register/index",$("#register_form").serialize(), function (data){
$('#w4l-reg-name').removeClass('error');
$('#w4l-reg-name span').html('');
$('#w4l-reg-number').removeClass('error');
$('#w4l-reg-number span').html('');
$('#w4l-reg-email').removeClass('error');
$('#w4l-reg-email span').html('');
$('#w4l-reg-email2').removeClass('error');
$('#w4l-reg-email2 span').html('');
$('#w4l-reg-password').removeClass('error');
$('#w4l-reg-password span').html('');
$('#w4l-reg-password2').removeClass('error');
$('#w4l-reg-password2 span').html('');


var resp = null;
try {
resp = $.parseJSON(data);
} catch (e){
alert('Communication error. Please try again later' );
return;
}
if(typeof(resp.errors) != 'undefined') {
for(var i in resp.errors) {
if(resp.errors[i] != '') {
$('#'+i).addClass('error');
$('#'+i+' span').html(resp.errors[i]);
}
}
} else {
alert(resp.msg);
location.href=BASE_PATH;
}
});
}
-------------------------------------------------------------------------------------------------



      function index()
    {
        $this->form_validation->set_rules('name', 'Full Name', 'trim|required|xss_clean');
        $this->form_validation->set_rules('email', 'Email Address', 'trim|xss_clean|required|valid_email|matches[email2]|callback_emailCheck');
        $this->form_validation->set_rules('email2', 'Confirm Email Address', 'trim|xss_clean|required|valid_email');
        $this->form_validation->set_rules('number', 'Favorite Number', 'trim|required|xss_clean|is_natural|less_than[100]');
        $this->form_validation->set_rules('password', 'Password', 'trim|xss_clean|required|matches[password2]');
        $this->form_validation->set_rules('password2', 'Confirm Password', 'trim|xss_clean|required');
        if ($this->form_validation->run() == FALSE)
        {
$err = array();
$err['w4l-reg-name'] =  form_error('name');
$err['w4l-reg-email'] =  form_error('email');
$err['w4l-reg-email2'] =  form_error('email2');
$err['w4l-reg-number'] =  form_error('number');
$err['w4l-reg-password'] =  form_error('password');
$err['w4l-reg-password2'] =  form_error('password2');

echo json_encode(array('errors' => $err));
        }
        else
        {
            $this->user_model->add_user();
$success = array("msg"=>"You have successfully added a new user!");
echo json_encode($success);
        }
    }

For removing index.php from the codeigniter urls

For removing index.php from the codeigniter urls:

Create a .htaccess file with the following contents:


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Put it outside the application folder.

Wednesday, January 23, 2013

Json communication from php to jquery


-------------------------------------------------------------------------
Jquery code: 

$.post(url",{'product[]':b,store_id:slave_stores[d]}, function (data){

                  var response = $.parseJSON(data);

                  if(typeof(response.count) != 'undefined') {

                               alert( response.count);
                   }

});
-----------------------------------------------------------------------
Php Code in ajax function:

$reply = array(

                    'count' => $pcount,

                      'message' => "testing"

);

echo json_encode($reply);