I was interested if Gideros UrlLoader could work with sessions, so I created a little test.
Here's a simple PHP script, that initialize session on first call and prints out session variables on second
<?php
session_start();
if(!isset($_SESSION["test"]))
{
$_SESSION["test"] = "test";
echo "Session init";
}
else
{
print_r($_SESSION);
}
?> |
So first attempt I tried to reuse same UrlLoader instance:
local loader = UrlLoader.new()
local function onComplete(e)
print(e.data)
end
loader:addEventListener(Event.COMPLETE, onComplete)
loader:load("<a href="http://localhost/test.php"" rel="nofollow">http://localhost/test.php"</a><img class="emoji" src="https://forum.gideros.rocks/resources/emoji/wink.png" title=";)" alt=";)" height="20" />
Timer.delayedCall(2000, function()
loader:load("<a href="http://localhost/test.php"" rel="nofollow">http://localhost/test.php"</a><img class="emoji" src="https://forum.gideros.rocks/resources/emoji/wink.png" title=";)" alt=";)" height="20" />
end) |
And result is yes, session was stored successfully, thus the output:
Uploading finished.
Session init
Array
(
[test] => test
) |
Nice! It means somewhere deep in there cookies are stored.
Then I tried to use different instances and result is the same. Meaning cookies stored are the same for all UrlLoader instances.
But if you exit the app and open it again, session will be initialized from the start.
In any other way feel free to use sessions in Gideros with UrlLoader
Comments