[Solved] Error in function 'session($sessionId)'  

  RSS

abahaudd
(@abahaudd)
Active Member
Joined: 7 months ago
Posts: 8
30/03/2019 2:58 pm  

Hello,

This function in the PHP library is giving an error for $data (it is not defined with in the function).  

Is the $sessionId = 'JSESSIONID' which we get back after login ?

public static function session($sessionId){

return self::curl('/api/session?'.$data,'GET',$sessionId,'',array());
}
This topic was modified 7 months ago by jaimzj

Quote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 58
30/03/2019 3:54 pm  

First step for you to understand would be to look at examples that are already shared. 

https://github.com/gpsguru/traccar-ui-php/blob/master/loginDo.php

check the above link, It will answer your question.

Markers & maps are magical !!!


ReplyQuote
abahaudd
(@abahaudd)
Active Member
Joined: 7 months ago
Posts: 8
31/03/2019 6:51 pm  

Thank you so much.  That did answer the second part of my question (the one on session id). 

And sort of gave an answer to the first of the question (Error: $data not defined) as well.

I guess that ".$data" is not needed, right ?  Because the value of $sessionId is "JSESSIONID=node01r9...........node0"

Is it safe to remove ".$data" ?  Am I missing something here ?

public static function session($sessionId){

return self::curl('/api/session?'.$data,'GET',$sessionId,'',array());
}

ReplyQuote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 58
31/03/2019 10:25 pm  

It should be okay to remove $data from this particular function as we are not passing any data here.

However other functions will  still return you the error you are referring to can be ignored for now as it does not impact the functioning of the code and its expected results. You can always disable your PHP error display settings (which is what you would do on your live site anyway).

Markers & maps are magical !!!


ReplyQuote
abahaudd
(@abahaudd)
Active Member
Joined: 7 months ago
Posts: 8
01/04/2019 7:33 pm  

Thanks


ReplyQuote
Share:
  
Working

Please Login or Register