|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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"; After that I ran the following code to load the variables into the engine: Code:
f = loadstring(result); f(); 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
|
|||
|
|||
|
Hey guys! Thanks for the replies. I ended up going with the XML. It works great!
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
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.






Linear Mode

