<!--afichage du source de l'exemple-->
<a href="create_dom.phps">afficher le source</a><br>
<?php
function Create_New_Domain($Domain$Period$Reg_type$Owner$Admin$Billing$Tech$ns1$ns2$ns3$ns4$ns5$SESSIONAPI) {
global 
$soapclient$SoapRetour$SoapEnvironment;

$tab=array(
    
"environment"    => $SoapEnvironment,
    
"retour"    => $SoapRetour,
        
"domain"    => $Domain,
        
"operation"    => "sw_register",
        
"period"    => $Period,
        
"reg_type"    => $Reg_type,
    
"NIC_owner"    => $Owner,
    
"NIC_admin"    => $Admin,
    
"NIC_billing"    => $Billing,
    
"NIC_tech"    => $Tech,
        
"nameserver1"    => $ns1,
        
"nameserver2"    => $ns2,
        
"nameserver3"    => $ns3,
        
"nameserver4"    => $ns4,
        
"nameserver5"    => $ns5,
    
"registrant_ip"    => $_SERVER['REMOTE_ADDR'],
    
"id_session"    => $SESSIONAPI,
    );
return 
$tab;
}

function 
renew_domain($domain$currentexpirationyear$period$SESSIONAPI) {
global 
$soapclient$SoapRetour$SoapEnvironment$params;

$tab=array(
    
"environment"    => $SoapEnvironment,
    
"retour"    => $SoapRetour,
        
"domain"    => $domain,
        
"operation"    => "renew_domain",
        
"currentexpirationyear"    => $currentexpirationyear,
    
"period"    => $period,
    
"registrant_ip"    => $_SERVER['REMOTE_ADDR'],
    
"id_session"    => $SESSIONAPI,
    );
return 
$tab;
}

function 
formulaire() {
if (
$_POST['owner']!=""$ow=$_POST['owner']; else $ow="-SD";
if (
$_POST['admin']!=""$ad=$_POST['admin']; else $ad="-SD";
if (
$_POST['billing']!=""$bi=$_POST['billing']; else $bi="-SD";
if (
$_POST['tech']!=""$te=$_POST['tech']; else $te="-SD";
if (
$_POST['domain']!=""$do=$_POST['domain']; else $do="";

echo 
"Création/transfert d'un domaine chez simpledomaine.fr:<br><form method=\"post\">
Nic Owner: <input type=\"text\" name=\"owner\" value=\"$ow\" size=\"8\">, 
Nic Admin: <input type=\"text\" name=\"admin\" value=\"$ad\" size=\"8\">, 
Nic Tech: <input type=\"text\" name=\"tech\" value=\"$te\" size=\"8\">, 
Nic Billing: <input type=\"text\" name=\"billing\" value=\"$bi\" size=\"8\">, 
DNS1:<input type=\"text\" name=\"ns1\" value=\"ns1.yellis.net\" size=\"20\">, 
DNS2:<input type=\"text\" name=\"ns2\" value=\"ns2.yellis.net\" size=\"20\">
<br>
Domaine:<input type=\"text\" name=\"domain\" value=\"$do\">
<select name=\"reg_type\"><option value=\"new\">new</option><option value=\"transfer\">transfer</option></select>
, durée:<select name=\"period\"><option value=\"1\">1 an</option><option value=\"2\">2 ans</option></select>
<input type=\"submit\" value=\"créer\">
</form>"
;

echo 
"Renouvellement d'un domaine chez simpledomaine.fr:<br><form method=\"post\">Domaine:<input type=\"text\" name=\"domain\">, expire le:<input type=\"text\" name=\"expire\"><input type=\"submit\" value=\"renouveller\"></form>";
}

if (
$_POST['domain']==""formulaire(); else {
// inclusion de la librairie nusoap: client SOAP
require_once 'lib/nusoap.php';

// inclusion du fichier de configuration
require_once 'config.inc.php';

// connexion au serveur Soap
$soapclient = new soapclient($SoapUrl.'?'.$wsdl$wsdl$proxyhost$proxyport$proxyusername$proxypassword);
//$options = array('namespace'=>'urn:xxxx','trace'=>1,'timeout'=>'20');
$soapclient->timeout 240;
$soapclient->response_timeout 240;

$tab=array(
    
"environment"=>$SoapEnvironment,
    
"retour"=>$SoapRetour,
    
"operation"=>"login",
    
"Login"=>$SoapLogin,
    
"Passwd"=>$SoapPasswd,
    );

$params=array(&$tab);
//echo "<pre>"; print_r($params); echo "</pre>";
$result=unserialize($soapclient->call($tab['operation'],$params,$options));
//echo "<pre>"; print_r($result)."\n"; echo "</pre>"; 

// creation du domaine
if ($_POST['reg_type']=="new" OR $_POST['reg_type']=="transfer"$tab=Create_New_Domain($_POST['domain'], $_POST['period'], $_POST['reg_type'], $_POST['owner'], $_POST['admin'], $_POST['billing'], $_POST['tech'], $_POST['ns1'], $_POST['ns2'], $_POST['ns3'], $_POST['ns4'], $_POST['ns5'], $result['attributes']['session']);
if (
$_POST['expire']!=""$tab=renew_domain($domain$_POST['expire'], $period$result['attributes']['session']);

$params=array(&$tab);
echo 
"<h2>Requête</h2><pre>"print_r($params); echo "</pre>";
$result=unserialize($soapclient->call($tab['operation'],$params,$options));
echo 
"<h2>Réponse</h2><pre>"print_r($result)."\n"; echo "</pre>";

if (
$result['response_code']!="200"formulaire();
}
?>