Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7682565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:35:51+00:00 2026-05-31T18:35:51+00:00

I am trying to expand my class with a new function, i can already

  • 0

I am trying to expand my class with a new function, i can already request a users history data but i now want to request multiple users at a time.

I do something similar already where i can request multiple users last position – see below

/**
 * Get last position of the user
 * @param mixed $user string/int user identificator
 * @return array associative array with these keys: status, timestamp, longitude, latitude
 */
public function getLastPosition($user) {
    $this->_checkLoggedIn(__METHOD__);

    $getLastPositionRequest = $this->_xml->getLastPositionRequest($this->application_id, $this->request_id, $user);
    $getLastPositionResponse = $this->_transport->request(self::PATH_LAST_LOCATION, $getLastPositionRequest);
    $return = $this->_xml->parseGetLastPositionResponse($getLastPositionResponse);

    $this->request_id++;

    $return['user_id'] = $user;

    return $return;
}

/**
 * Get mutiple positions at once
 * @param array $users associative array of users username => user id
 * @return array associative array of username => associative array with keys: status, timestamp, longitude, latitude
 */
public function getLastPositions($users)
{
    $return = array();
    $return1 = array();
    $i=0;

    foreach($users as $user => $id) {
        $u=new UsersData();
    $u->name=$user;
    $u->data=$this->getLastPosition($id);
        $return[$i] = $u;
        $i = $i + 1;
        //$return[$user]= $return1[$i];
    }

    return $return;
}

Here is my get history request, how can i run this to get the history data of multiple users at once?

public function getHistoryQuery($user, $start_time, $end_time)
{
    $this->_checkLoggedIn(__METHOD__);

    $historyQueryRequest = $this->_xml->getHistoryQueryRequest($this->application_id, $this->request_id, $user, $start_time, $end_time);
    $historyQueryResponse = $this->_transport->request('soap/gps/historyquery', $historyQueryRequest);
    $return = $this->_xml->parseHistoryQueryResponse($historyQueryResponse);

    $this->_request_id++;

    return $return;
}

Here is the parseHistoryQueryResponse function used in getHistoryQuery

/**
* Parse XML gps history response
*/
public function parseHistoryQueryResponse($historyQueryResponse)
{
    $match = array(
        'user' => 'User'
    );

    $x = $this->_match($match, $historyQueryResponse);

    $chunks = explode('</n:GpsData>', $historyQueryResponse);

    $match = array(
        'timestamp' => 'Timestamp',
        'longitude' => 'longitude',
        'latitude' => 'latitude'
    );

    $data = array();

    foreach($chunks as $chunk) {
        $tmp = $this->_match($match, $chunk);
        $tmp['timestamp'] = $tmp['timestamp'] / 1000;
        $tmp['longitude'] = $tmp['longitude'] / 1000000;
        $tmp['latitude'] = $tmp['latitude'] / 1000000;

        if ($tmp['timestamp'] > 0) {
            $data[] = $tmp;
        }
    }

    return array(
        'user' => $x['user'],
        'data' => $data
    );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:35:52+00:00Added an answer on May 31, 2026 at 6:35 pm

    Why don’t you take the same approach you’ve already taken?

    public function getMultipleHistories($users, $start_time, $end_time)
    {
        $this->_checkLoggedIn(__METHOD__);
    
        $result = array();
    
        foreach($users as $user) {
    
            $historyQueryRequest = $this->_xml->getHistoryQueryRequest($this->application_id, $this->request_id, $user, $start_time, $end_time);
            $historyQueryResponse = $this->_transport->request('soap/gps/historyquery', $historyQueryRequest);
            $result[] = $this->_xml->parseHistoryQueryResponse($historyQueryResponse);
    
            $this->_request_id++;
    
        }
    
    
        return $result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a template class for matrices/vectors I want to expand
I'm trying to expand my Core Data. So I added a new attribute to
I'm trying to create a table class, who's rows and columns may expand or
I have a simple script: $('.expand').each(function(i){ var _Expand = $(this).parent(); ExpGroupBy(_Expand); }); Trying to
I am trying to make the outer class - rightholder_empty , expand vertically with
I am trying to create a simple function that can take a parameter and
I'm still new to CSS but I've been trying to find the answer to
I am trying to expand the devise registration form to allow a new user
I'm trying to expand navigation options of the context menu on certain elements (specifically,
I'm currently trying to expand my PHP driven intranet site for my company. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.