/**
  * Get session ID.
  *
  * @return string
  */
 public function get_session_id()
 {
     if ('yes' == $this->gateway->debug) {
         $this->gateway->log->add($this->gateway->id, 'Requesting session ID...');
     }
     $url = add_query_arg(array('email' => $this->gateway->get_email(), 'token' => $this->gateway->get_token()), $this->get_sessions_url());
     $response = $this->do_request($url, 'POST');
     // Check to see if the request was valid.
     if (is_wp_error($response)) {
         if ('yes' == $this->gateway->debug) {
             $this->gateway->log->add($this->gateway->id, 'WP_Error requesting session ID: ' . $response->get_error_message());
         }
     } else {
         try {
             $session = $this->safe_load_xml($response['body'], LIBXML_NOCDATA);
         } catch (Exception $e) {
             $session = '';
             if ('yes' == $this->gateway->debug) {
                 $this->gateway->log->add($this->gateway->id, 'Error while parsing the PagSeguro session response: ' . print_r($e->getMessage(), true));
             }
         }
         if (isset($session->id)) {
             if ('yes' == $this->gateway->debug) {
                 $this->gateway->log->add($this->gateway->id, 'PagSeguro session is valid! The return is: ' . print_r($session, true));
             }
             return (string) $session->id;
         }
     }
     if ('yes' == $this->gateway->debug) {
         $this->gateway->log->add($this->gateway->id, 'Session Response: ' . print_r($response, true));
     }
     return false;
 }