#Region Project Attributes
#ApplicationLabel: AAA Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Dim j As HttpJob
j.Initialize("j", Me)
Dim values As Map
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
''''''''''''''''''''''' try 1
values.Initialize
values.Put("username","user")
values.Put("password","pass")
'j.PostMultipart("https://xxxxxxxxxxxxxxxx/index.php",values,Null)
''''''''''''''''''''''' try 2
'j.Username = "xxx"
'j.Password = "xxx"
'j.PostString("https://xxxxxxxxxxxxxxxx/index.php", "")
''''''''''''''''''''''' try 3
Dim userPwd As String = "user:password"
Dim su As StringUtils
Dim byt() As Byte = userPwd.GetBytes("UTF8")
Dim suUserPwd As String = su.EncodeBase64(byt)
j.Download("https://xxxxxxxxxxxxxxxx/index.php")
j.GetRequest.SetHeader("Authorization:","Basic "&suUserPwd)
''''''''''''''''''''''' try 4
'j.Download2("https://xxxxxxxxxxxxxxxx/index.php", Array As String("username","xxx","password","xxxx"))
wait for (j) JobDone(job As HttpJob)
If job.Success Then
Dim response As String = job.GetString
Log(response)
xui.MsgboxAsync(response, "PHP response")
Else
Log(job.ErrorMessage)
xui.MsgboxAsync(job.ErrorMessage, "PHP error")
End If
End Sub