Session Functions
These are good reasons for interfacing to pages using a web API if it is available! Many interactive enquiry systems set a verification string and/or a session id.
In this case two fetches may need to be made to access data. The first may set up the verification string (entering agreement info if required) and the second will access the actual data page.
$t->setSessionValue( )
Parameters | |
---|---|
$key | A String containing the reference to use for recall. |
$value | The session value captured |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] \\ $t->row("|index2.php\?eduId={EDUID}&display|U", "{EDUID}"); $eduid = $t->result; $t->setSessionValue("eduid", $eduid);
Note
The session value is unique to a user and answerspace. Clearing cookies can clear the session id values.
$t->getSessionValue( )
Parameters | |
---|---|
$key | A String containing the reference to use for recall. |
Return Values | |
---|---|
$t->result | Returns requested session value into $t->result on $->getSessionValue() |
$eduid = $t->getSessionValue('eduid'); if(!$eduid) { return "Please login."; }
Note
The session value is unique to a user and answerspace. Clearing cookies can clear the session id values.
$t->runLoginStatusInteraction( )
This function will execute the MADL code defined inside the LOGIN STATUS Interaction of a Custom Authentication Process.
It's more convenient, because you don't need to specify the Interaction's name, it works it out based on your answerSpace configuration.
It's useful because it returns exactly what the LOGIN STATUS Interaction would return (either the Boolean false, or an array of user details).
If the Interaction you are currently working on needs to behave differently if the user is not logged in, then you can use this function to quickly check.
Parameters | |
---|---|
NONE |
Return Values | |
---|---|
$t->result | (either the Boolean false, or an array of user details). |
$account = $t->runLoginStatusInteraction();