Indigo Rose Software

Go Back   Indigo Rose Software Forums > Old Versions > TrueUpdate 2.0

 
 
Thread Tools Display Modes
  #1  
Old 12-06-2005
SeizeTheDave SeizeTheDave is offline
Forum Member
 
Join Date: Oct 2005
Posts: 5
HTTP Submit - How do I get return values

In TU v1.0, I was able to submit to a web page and have values sent back to me in the web page. For example, I would receive an html page that looked like this:

<TRUEUPDATE10>%value1%,%value2%</TRUEUPDATE10>

<%value1%>Hello</%value1%>

<%value2%>World</%value2%>


From there I could use "%value1%" and "%value2%" as actual variables within my script.

How do I do this now? The HTTP.Submit seems to only put all of this into a string. Is there a way to get the values without having to write a function to parse through the results?

I have tried sending back a string that looks like {value1="Hello",value2="World"} in hopes of turning it into an array. That didn't work.

Any ideas? Thanks!

Dave
  #2  
Old 12-07-2005
Brett's Avatar
Brett Brett is offline
Indigo Rose Staff Member
 
Join Date: Jan 2000
Posts: 2,001
You are right in that it does not automatically parse out variables anymore. The best thing to do in my opinion is to have your server script return XML text and then use the XML actions to parse it up.

If you do return a script such as:

tblData = {value1="Hello",value2="World"};

Take the string and save it to a file using TextFile.WriteFromString to write it to a file and then use Application.LoadScript to load the script file in. Then the tblData values will be available to your scripts from there.
  #3  
Old 12-07-2005
Mark's Avatar
Mark Mark is offline
Indigo Rose Staff Member
 
Join Date: Jun 2000
Location: Indigo Rose Software
Posts: 1,773
Hi SeizeTheDave,

You can also take advantage of the built-in lua function loadstring() which basically loads a string into the lua engine and assigns it to an anonymous function.

Here's an example that I got working:

I created a php script that returned the following information:
Code:
value1="Hello";value2="Hello2";
Then I ran the HTTP.Submit action and stored the return value in the variable "result"

After that I ran the following code to load the variables into the engine:
Code:
f = loadstring(result);
f();
Now the variables value1 and value2 have been loaded into the lua engine with the values "Hello" and "Hello2" respectively.

Here is all the code listing:

Code:
result = HTTP.Submit("HTTP://XXX/mark.php", {},SUBMITWEB_POST, 30, 80, nil, nil);
f = loadstring(result);
f();
Dialog.Message(value1,value2);
__________________
MSI Factory The Next Generation Intelligent Setup Builder
  #4  
Old 12-21-2005
SeizeTheDave SeizeTheDave is offline
Forum Member
 
Join Date: Oct 2005
Posts: 5
Hey guys! Thanks for the replies. I ended up going with the XML. It works great!
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare Values in tables Byte AutoPlay Media Studio 5.0 7 06-18-2005 03:36 PM
Example: HTTP Actions and Proxy Servers Adam AutoPlay Media Studio 5.0 Examples 0 05-26-2004 02:48 PM
Calling DLL Functions with string return values DanKerns Setup Factory 6.0 3 11-08-2002 03:44 PM
Catching return values of execute file commands Cedric Setup Factory 6.0 2 09-30-2002 12:00 PM


All times are GMT -6. The time now is 12:47 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software