Таким образом, я запускал некоторые тесты в веб-сервисе, и он отлично работает с моим кодом на С#:
// The objet to do the request
server.CustomerWS Auth = new server.CustomerWS();
// The object we will use to store the request
server.customerXML Cust = new server.customerXML();
// Request
Cust = Auth.authenticate(login, password);
if (cust.retour == true)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("KO");
}
Мне нужно преобразовать этот код в PHP, будучи полным noob на этом языке. Я бы оценил любую помощь, которую я могу получить, чтобы начать работу, главной проблемой является то, что я не знаю, как обращаться с объектами, исходящими из веб-сервиса в PHP.
Я не использую php5 на моем сервере, поэтому я не могу использовать функции soap php.
спасибо за помощь
// -- specify your Web Service URL and also the login and password (should be really protected : use HTTPS and send these parameters in POST)
$url = 'http://....';
// The objet to do the request
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
// The object we will use to store the request
$result = NULL;
$xml = new SimpleXmlElement(curl_exec($curl));
if ($xml->retour[0] == true){
print ("OK");
}else{
print("KO");
}
Надеюсь, это поможет :)