PDA

Voir la version complète : soap domaininfo


staff
11/02/2009, 21h10
Bonsoir tout le monde ;)

j'aurai une question j'ai un espace membre et j'essaye d'utiliser l'api d'ovh pour afficher le domaine de l'utilisateur dans son espace membre.


<?php

$soap = new SoapClient('http://www.ovh.com/soapi/soapi-1.1.wsdl');

//login
try {

$login = "xxxxxx-ovh";
$password = "******";
$language = null;
$multisession = false;

$session = $soap->login($login,$password,$language,$multisession);

echo "login successfull<br/>";

} catch(SoapFault $fault) {
echo "Error : ".$fault;
}

//domainInfo
try {

$result = $soap->domainInfo($session, $siteweb);

echo "domainInfo successfull<br/>";
print_r($result); // place your code here ...
echo "<br/>";

} catch(SoapFault $fault) {
echo "Error : ".$fault;
}

//logout
try {

$result = $soap->logout($session);

echo "logout successfull<br/>";

} catch(SoapFault $fault) {
echo "Error : ".$fault;
}

?>


Mais maintenant je voudrait récupérer les infos dans un tableau

il nous disent ceci pour le retour:

string domain : the domain creation date
string creation : the domain creation date
string modification : the domain last modification date
string expiration : the domain expiration date
string nicowner : the owner handle
string nicadmin : the admin handle
string nictech : the tech handle
string nicbilling : the billing handle
string authinfo : le 'authinfo' si le domaine est dévérrouillé (gTlds)
nsStruct[] dns : an array of ns structure

Comment afficher(récupérer) par exemple la date de création dans mon tableau.

Merci pour vos réponse

flox
16/02/2009, 11h31
comme tu peux le voir avec print_r, le retour est un object, donc simplement :



[...]

//domainInfo
try {

$result = $soap->domainInfo($session, $siteweb);

echo "domainInfo successfull<br/>";
//print_r($result); // place your code here ...

echo "la date de creation : " . $result->{'creation'};

echo "<br/>";

} catch(SoapFault $fault) {
echo "Error : ".$fault;
}

[...]




login successfull
domainInfo successfull
la date de création : 2006-05-05
logout successfull

inforama
10/06/2009, 09h19
Bonjour,
Moi aussi j'ai un petit problème mais cela concerne l'affichage des dns.
On nous dit qu'ils sont sous la forme nsStruct[] dns : an array of ns structure.

J'arrive à afficher le tableau de premier dns avec la commande :

print_r ($result['dns'][0]);
et j'ai comme résultat : Array ( [ip] => [name] => dns13.ovh.net )

Par contre j'aimerais juste afficher le "dns13.ovh.net" sans les fioritures de array, ip et name à coté, mais je n'y arrive pas.

J'ai essayé en faisant $temp = $result['dns'][0];
echo $temp['ip']['name']; mais cela ne fonctionne pas.

Est ce qu'une ame charitable voudrait bien m'aider? Merci d'avance ^^

inforama
10/06/2009, 20h17
Je viens de trouver la solution
echo $result['dns'][0]['name'];

En fait ip est une variable et non un tableau et elle n'est pas définie.
J'avais pas fait attention, désole du dérangement ^^