private function getResponse($data) {
    /* Convert the array with data to a request string. */
    $query = http_build_query($data);

    /* Set up array with options for the context used by file_get_contents(). */
    $opts = array(
      'http'=>array(
        'method'  => 'GET',
        'timeout' => $this->_serverTimeout,
        'header'  => "Accept-language: en\r\n" .
                     "User-Agent: phpSec (http://phpseclib.com)\r\n"
      )
    );

    /* Create context. Allowing us to specify User-Agent. */
    $context = stream_context_create($opts);

    /* Try to get response from Yubico server. */
    $attempts = 0;
    $response = false;
    while($response === false && $attempts < $this->_numServers) {
      /* select a Yubico API server. */
      $server = array_rand($this->_servers);
      $response = @file_get_contents($this->_servers[$server].'?'.$query, null, $context);
      $attempts++;
    }

    if($response === false) {
      /* Could not make request. */
      return false;
    }

    /* Parse response and create an array with the data. */
    $lines = explode("\r\n", $response);
     foreach($lines as $line) {
       if(trim($line) != '') {
         list($key, $val) = explode("=", $line, 2);
         $rdata[$key] = trim($val);
       }
    }

    /* All done. */
    return $rdata;
  }
private function getResponse($data) {
    /* Convert the array with data to a request string. */
    $query = http_build_query($data);

    /* Set up array with options for the context used by file_get_contents(). */
    $opts = array(
      'http'=>array(
        'method'  => 'GET',
        'timeout' => $this->_serverTimeout,
        'header'  => "Accept-language: en\r\n" .
                     "User-Agent: phpSec (http://phpseclib.com)\r\n"
      )
    );

    /* Create context. Allowing us to specify User-Agent. */
    $context = stream_context_create($opts);

    /* Try to get response from Yubico server. */
    $attempts = 0;
    $response = false;
    while($response === false && $attempts < $this->_numServers) {
      /* select a Yubico API server. */
      $server = array_rand($this->_servers);
      $response = @file_get_contents($this->_servers[$server].'?'.$query, null, $context);
      $attempts++;
    }

    if($response === false) {
      /* Could not make request. */
      return false;
    }

    /* Parse response and create an array with the data. */
    $lines = explode("\r\n", $response);
     foreach($lines as $line) {
       if(trim($line) != '') {
         list($key, $val) = explode("=", $line, 2);
         $rdata[$key] = trim($val);
       }
    }

    /* All done. */
    return $rdata;
  }
private function getResponse ( $ data ) { /* Convert the array with data to a request string. */ $ query = http_build_query ( $ data ) ; /* Set up array with options for the context used by file_get_contents(). */ $ opts = array ( 'http' => array ( 'method' => 'GET' , 'timeout' => $ this -> _serverTimeout , 'header' => "Accept-language: en\r\n" . "User-Agent: phpSec (http://phpseclib.com)\r\n" ) ) ; /* Create context. Allowing us to specify User-Agent. */ $ context = stream_context_create ( $ opts ) ; /* Try to get response from Yubico server. */ $ attempts = 0 ; $ response = false ; while ( $ response === false && $ attempts < $ this -> _numServers ) { /* select a Yubico API server. */ $ server = array_rand ( $ this -> _servers ) ; $ response = @ file_get_contents ( $ this -> _servers [ $ server ] . '?' . $ query , null , $ context ) ; $ attempts ++ ; } if ( $ response === false ) { /* Could not make request. */ return false ; } /* Parse response and create an array with the data. */ $ lines = explode ( "\r\n" , $ response ) ; foreach ( $ lines as $ line ) { if ( trim ( $ line ) != '' ) { list ( $ key , $ val ) = explode ( "=" , $ line , 2 ) ; $ rdata [ $ key ] = trim ( $ val ) ; } } /* All done. */ return $ rdata ; }
Make a request to the Yubico servers and get the response.

@param array $data
Array containing the key/values for the request.

@return array
Array containing key/values from the response.
Make a request to the Yubico servers and get the response .