Other to pass variables to PHP

Discussion in 'iOS Questions' started by Stefano Grandi, Jun 4, 2018.

  1. Stefano Grandi

    Stefano Grandi Member Licensed User


    Code:
    Dim Indirizzo_Server="79.8.xx.xxx" As String 
        
    Dim Nome ="STEFANO"  As String
        
    Dim PW ="000000000" As String
            
        WebView1.LoadUrl(
    "http://" & Indirizzo_Server &  "/prova.php?nome='" & Nome & "' & passwordonline='" & PW & "'")


    ' in PHP:
    <?php 

    $nome=$_GET[
    'nome'];
    $passwordonline=$_GET['passwordonline'];
    echo("Nome: " & $nome & "<br>");
    echo(
    "passwordonline: " & $passwordonline);
    ?>
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Stefano Grandi

    Stefano Grandi Member Licensed User

     
  4. tufanv

    tufanv Expert Licensed User

    I dont know any differences between b4a and b4i about httputils or webview. they must be the same
     
  5. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    For me is working fine with webservice construct with PHP, like this:

    Server Side:
    Code:
    <?php

      $
    id      = $_GET['id'];
      $iduser  = $_GET['iduser'];
      $version = $_GET['version'];
      $uuid    = $_GET['uuid'];

    ?>
    and App Side
    Code:
    Dim jobGet As HttpJob
    jobGet.Initialize(
    "jobname", me)
    jobGet.Download(
    "http://myserver/page.php?id=111&iduser=333&version=1.1.1&uuid=4444444444444")
    Just be careful with special characters, for this use like this:
    Code:
    Dim SU As StringUtils
     
    Dim strSearch As String = "id=111&iduser=333&version=1.1.1&uuid=4444444444444&Search=" &SU.EncodeUrl("nonon  nonon ononononon nonon""UTF8")

    Dim jobGet As HttpJob
    jobGet.Initialize(
    "jobname", me)
    jobGet.Download(
    "http://myserver/page.php?" & strSearch)
     
  6. Stefano Grandi

    Stefano Grandi Member Licensed User

     
  7. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    I don't understand your question... You mean the result of this download?

    if yes, when you send the download command you will receive in "jobDone" event, like this:

    Code:
    Sub JobDone (Job As HttpJob)
      
           
    If Job.Success = True Then
      
            
    Select Job.JobName
         
                
    Case "jobname"
                        
    Dim strResult as string = Job.GetString

            
    End Select
     
      
        
    End If
      
        Job.Release
      
    End Sub
    and you can use "strResult" in your webview
     
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. Stefano Grandi

    Stefano Grandi Member Licensed User

     
  10. techknight

    techknight Well-Known Member Licensed User

    Word of caution: I never send variables in the GET method. Thats how they get logged/sniffed easier. use the POST method instead.
     
  11. ayman salah shbaan

    ayman salah shbaan Member Licensed User

    The version is likely to be PHP7 ?
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice