I've got a little script, which should be used to handle two things
1. user login, save this in a php session
2. send back some information
But the demo doesn't work?
Every time a call the script i will get a new phpsession id.
Is it possible to change the location of the request object and not to use a New1(...) call?
the basic sourcecode
' wwwres webresponse
' wwwreq webreuest
'
PHP Script
based on this thread:
http://www.b4x.com/forum/questions-help-needed/2994-reciving-cookie-how.html
1. user login, save this in a php session
2. send back some information
But the demo doesn't work?
Every time a call the script i will get a new phpsession id.
Is it possible to change the location of the request object and not to use a New1(...) call?
the basic sourcecode
' wwwres webresponse
' wwwreq webreuest
'
B4X:
Sub Globals
'Declare the global variables here.
URL="http://domain/session.php"
End Sub
Sub App_Start
wwwres.New1
wwwreq.New1(URL)
wwwres.Value = wwwreq.GetResponse
regex.New1("PHPSESSID=.[a-zA-Z0-9]+")
match.New1
match.Value=regex.Match(wwwres.Headers)
GC_Session_ID=match.String
Msgbox(GC_Session_ID)
wwwreq.New1(URL&"?do=2")' init with a value
wwwreq.Method = "GET"
wwwres.Value = wwwreq.GetResponse 'This line calls the server and gets the response.
string = wwwres.GetString 'Get the Response string.
Msgbox("2:"& string) ' return some value
wwwreq.New1(URL&"?do=3") ' read it from session
wwwreq.Method = "GET"
wwwres.Value = wwwreq.GetResponse 'This line calls the server and gets the response.
string = wwwres.GetString 'Get the Response string.
Msgbox("3:"& string) ' return nothing
'--> i expect "some value" @ result
wwwres.Close
End Sub
PHP:
<?php
if (session_id() == "") session_start();
switch ($_GET['do']) {
case 2:
$_SESSION["some_variable"]="some value";
echo $_SESSION["some_variable"];
break;
case 3:
echo "Session".$_SESSION["some_variable"];
break;
}
?>
based on this thread:
http://www.b4x.com/forum/questions-help-needed/2994-reciving-cookie-how.html
Last edited: