Returning a String in PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • majik92
    Forum Member
    • Feb 2007
    • 11

    Returning a String in PHP

    I'm creating an updater for my app. What I did was get the file version and then encrypt it with a MD5 hash using Crypto.MD5DigestFromString(). Then I submitted the encrypted file version to my site using HTTP.Submit(). I used the POST method. The PHP file will return a string that tells the app that it is up-to-date or if it needs to update.

    My question is how do I return a string to the app with PHP? Is this how you do it?

    Code:
    <?php
    
    $app_file_version=$_POST["file_version"];
    $latest_file_version=md5("1.0.7.6");
    
    if ($app_file_version!==$latest_file_version) {
         echo("updatenow");
    } else {
         echo("okay");
    }
    
    ?>
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1790

    #2
    The result of HTTP.Submit() will contain what ever the PHP script return.

    Code:
    result = HTTP.Submit(..your submit info..)
    
    if result == "okay" then
        Dialog.Message("Info", "You have the latest version.")
    elseif result == "updatenow" then
        Dialog.Message("Info", "There is a newer version avaialable.")
    else
        -- handle anything else return or an error
    end
    Dermot

    I am so out of here :yes

    Comment

    • Brett
      Indigo Rose Staff Member
      • Jan 2000
      • 2000

      #3
      Dermot hit the nail on the head. The HTTP.Submit action returns the raw text sent backby the Web page.

      Comment

      • TJ_Tigger
        Indigo Rose Customer
        • Sep 2002
        • 3159

        #4
        There is an example here to see another example. The mail PHP code returns success if all the variables are present. Otherwise it will return an error saying that one of the values was not present.

        Tigg
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment

        Working...
        X