How to get the echo string of PHP after Job.Success

sally3599

Member
Licensed User
Longtime User
I use the HttpJob to make a login process, a PHP script will return the result of login.

B4X:
<?php
   echo "Login failed!!";
?>

But how to get the echo string of PHP in JobDone ?

B4X:
Sub cmdSubmit_Click
    Dim jobPost As HttpJob
    jobPost.Initialize("JobPostName",Me)
    jobPost.PostString("http://website.com/test.php","user="&etUser.Text&"&pass="&etPass.Text)
End Sub

Sub JobDone (Job As HttpJob)
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        Select Job.JobName
            Case "JobPostName"
                ToastMessageShow("Result:" , True)
        End Select
    Else
        Log("Error: " & Job.ErrorMessage)
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub

Any help will be appreciate it.
 

BarrySumpter

Active Member
Licensed User
Longtime User
Job.GetString
This is how I do it in my first http test app:

B4X:
Sub JobDone (Job As HttpJob)

    'Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    
    
    If Job.Success = True Then
    
                
                lbl.Text = lbl.Text & "JobName = " & Job.JobName & ", Success = " & Job.Success & CRLF
                

                ' *****   Job.GetString
                lbl.Text = lbl.Text & "From Server : " & Job.GetString & CRLF & CRLF & CRLF
                
                Log(lbl.Text)
        
                btnTest3_Click    'success!


    Else
        
                ToastMessageShow("Error: " & Job.ErrorMessage, True)
      
                lbl.Text = lbl.Text & "JobName = " & Job.JobName & ", Success = " & Job.Success
                lbl.Text = lbl.Text  & CRLF & "Error: " & Job.ErrorMessage  & CRLF  & CRLF  & CRLF 
    
    End If
    


    Job.Release
    
    SetText   'of scrolling label lbl

End Sub
hth
 
Last edited:
Upvote 0
Top