コード例 #1
0
 * @return string
 * KO: Kwixo is not available
 * KC: Kwixo credit is not available
 * OK: each payment option is available
 */
  protected function getServiceStatus($mobile = false)
  {
      if ($mobile) {
          $statusvar = 'mstatus';
      } else {
          $statusvar = 'status';
      }
      //connects and get the response of the ws Availabe
      $con = new KwixoSocket($this->getUrlavailable());
      $res = $con->send();
      //return 'KO' if the connexion failed
      if ($res === false || !isXMLstringKwixo($res)) {
          return 'KO';
      }
      //builds an KwixoXMLElement to parse the server response
      $dom_response = new DOMDocument();
      $dom_response->loadXML($res);
      $element_online = $dom_response->getElementsByTagName('online')->item(0);
      //returns the attribute containing the server status
      return $element_online->getAttribute($statusvar);