Example #1
0
 public static function getTowns($postal_code)
 {
     try {
         $sc_options = array('connection_timeout' => 30);
         $soap_client = new SoapClient((string) Configuration::get('SEUR_URLWS_SP'), $sc_options);
         $data = array('in0' => '', 'in1' => '', 'in2' => $postal_code, 'in3' => '', 'in4' => '', 'in5' => Configuration::get('SEUR_WS_USERNAME'), 'in6' => Configuration::get('SEUR_WS_PASSWORD'));
         $response = $soap_client->infoPoblacionesCortoStr($data);
         if (empty($response->out)) {
             return false;
         } else {
             $string_xml = htmlspecialchars_decode($response->out);
             $xml = simplexml_load_string($string_xml);
             return $xml;
         }
     } catch (PrestaShopException $e) {
         $e->displayMessage();
     }
 }