$param->taux_change = $change; if (isset($_GET['taux_change'])) { //$params = new stdClass(); $arg = $_GET['taux_change']; if ($arg == '+') { $val = '+'; $param->taux_change_arg = $val; } if ($arg == '-') { $val = '-'; $param->taux_change_arg = $val; } if ($arg == '=') { $val = $change; $param->taux_change_arg = $val; } } $change = $service->getListPays($param); $tab = $change->Pays; $response = array(); foreach ($tab as $key => $value) { if ($value->libelle_fr == true) { $response[$key] = array($value->libelle_fr, $value->taux_change); } } print_r(json_encode($response)); // Affiche les informations du pays par rapport à la libellé choisi } } catch (SoapFault $fault) { echo "Error: ", $fault->faultcode, ", string: ", $fault->faultstring; }
<?php mb_internal_encoding('UTF-8'); ini_set('soap.wsdl_cache_enabled', 0); $service = new SoapClient("http://localhost:8080/ws/pays.wsdl", array("trace" => 1, "exception" => 0)); try { $param = new stdClass(); if (isset($_GET['monnaie_code'])) { $codemonnaie = $_GET['monnaie_code']; $param->monnaie_code = $codemonnaie; $pays = $service->getListPays($param); $response = array(); $listpays = $pays->Pays; if (sizeof($pays->Pays) == 1) { /** *[{'libelle': 'libelle_test', 'code_monney': 'CD_MONEY'}] */ $response = array($listpays->libelle_fr, $listpays->monnaie_code); print_r(json_encode($response)); } else { /** *[{'libelle': 'libelle_test', 'code_monney': 'CD_MONEY'}, * {'libelle': 'libelle_test2', 'code_monney': 'OTHER_CD_MONEY'}] */ foreach ($listpays as $key => $value) { $response[$key] = array($value->libelle_fr, $value->monnaie_code); } print_r(json_encode($response)); } } } catch (SoapFault $fault) {
if (isset($_GET['perdiem_monnaie'])) { $perdiem = $_GET['perdiem_monnaie']; $param->monnaie_perdiem = $perdiem; if (isset($_GET['monneiperdiem'])) { //$params = new stdClass(); $arg = $_GET['monneiperdiem']; if ($arg == '+') { $val = '+'; $param->monnaie_perdiem_arg = $val; } if ($arg == '-') { $val = '-'; $param->monnaie_perdiem_arg = $val; } if ($arg == '=') { $val = $perdiem; $param->monnaie_perdiem_arg = $val; } } $perdiem = $service->getListPays($param); $tab = $perdiem->Pays; $response = array(); foreach ($tab as $key => $value) { $response[$key] = array($value->libelle_fr, $value->monnaie_perdiem); } print_r(json_encode($response)); // Affiche les informations du pays par rapport à la libellé choisi } } catch (SoapFault $fault) { echo "Error: ", $fault->faultcode, ", string: ", $fault->faultstring; }