Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7488193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:47:03+00:00 2026-05-29T14:47:03+00:00

I am having issues getting the network.request function in Corona SDK working with a

  • 0

I am having issues getting the network.request function in Corona SDK working with a live webserver. It works fine on my localhost however the minute i change the code to talk to a remote server the application returns a nil value.

This is the code that i am using in the .lua file

local function networkListener( event )
    if ( event.isError ) then
        print( "Network error!")
    else
        print ( "RESPONSE: " .. event.response )
        local data = json.decode(event.response)
        responseText.text = data.result;
        messageText.text = data.message;
    end
end

------------------
--Send the request to the website to have the user Registered.
------------------
function AddUser (username, email, password, Device_Type, Device_ID)
        --Register Local
        network.request( "http://localhost/MobileApp/Register.php?loginid=" .. mime.b64(username) .. "&email=" .. mime.b64(email) .. "&password=" .. mime.b64(password) .. "&Device_Type=" .. mime.b64(Device_Type) .. "&Device_ID=" .. mime.b64(Device_ID), "GET", networkListener )
end

This is what the php server code should return in the form of json data:

    $result = array();
    $result["result"] = 200;
    $result["message"] = "Sucessfully Registered";
    echo json_encode($result);
    mysql_free_result($dbresult);
    exit;       

Or this if the request failed.

    $result = array();
    $result["result"] = 401;
    $result["message"] = "Please try another Username";
    echo json_encode($result);
    mysql_free_result($dbresult);
    exit;   

I have entered the URL directly into the browser from my PC and get the expected result

   {"result":200,"message":"Sucessfully Registered"}

so i can only assume that this is a latency issue and that the lua code is not waiting for a return value.
If anyone knows what is going on or how to resolve this issue i would be most appreciative.

Regards
Glen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T14:47:05+00:00Added an answer on May 29, 2026 at 2:47 pm

    I ended up getting it working by bypassing Corona for the downloading and just using LUA code. I still use the json decoder in Corona to parse the json infor

    Here is the code incase someone else has a similar issue:

    local http = require("socket.http")
    local json = require("json")
    
    
    local URL = "http://localhost/MobileApp/Register.php?loginid=" .. mime.b64(username) .. "&email=" .. mime.b64(email) .. "&password=" .. mime.b64(password) .. "&Device_Type=" .. mime.b64(Device_Type) .. "&Device_ID=" .. mime.b64(Device_ID);
    local response = http.request(URL)
    
    if response == nil then
        print("No Dice")
    else
        local data = json.decode(response)
        print(data.result);
        print(data.message);    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issues getting my remove element function working. I have this function:
I'm having issues getting jQuery to work correctly while testing on Localhost. The function
I'm working with some OpenGL code for scientific visualization and I'm having issues getting
I am having issues getting mongodb working with Django, my setup is Mac OS
I'm having issues getting a variable declared in an .click function to be updated
I'm having issues getting UpdatePanel working in a large, existing solution. I have a
I'm having issues getting a simple server/client socket app working in C# between two
I'm having issues getting my databinding working for a ListBox. I suspect it's because
The page I am working with is: http://glenwoodia.com/business-directory I am having issues getting the
Im having issues getting this to work, maybe its not even possible? I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.