I am kind of lost. What I am trying to do is create a script that posts 2 variables to a perl script via http, after the result is returned repost the result along with the 2 original variables.
Can this be done?
Posts: 12,072
Threads: 140
Joined: Dec 2002
This should work, although not tested. Requires QM 2.1.5 or later.
str var1="value1"
str var2="value2"
str result result2 sd
;urlencode
var1.escape(9)
var2.escape(9)
;format
sd.format("var1=%s&var2=%s" var1 var2)
;post
IntPost "http://www.lkjhguytre.com/folder/test.php" sd result
ShowText "" result ;;just for debugging
;urlencode result
result.escape(9)
;append result
sd.formata("&result=%s" result)
;post
IntPost "http://www.lkjhguytre.com/folder/test.php" sd result2
ShowText "" result2 ;;just for debugging
Is it possible to modify the code to use the post method instead of using the get method?
Posts: 12,072
Threads: 140
Joined: Dec 2002
IntPost uses POST method. IntGetFile uses GET method, where variables are appended to url.
I appreciate your help, and almost have it working. One last question. How can i modify the result to only have digits?
Posts: 12,072
Threads: 140
Joined: Dec 2002
What are result and result2 now?
result comes back as
&request=463696683719461691685641&
I need to resubmit only the number
Posts: 12,072
Threads: 140
Joined: Dec 2002
result.get(result 9 result.len-10)
Finally how can i write the results to a file. Thanks
Posts: 12,072
Threads: 140
Joined: Dec 2002
Is it possible to change the user agent from quick marcos?
Posts: 12,072
Threads: 140
Joined: Dec 2002
Insert this somewhere before first IntPost
IntSettings 0 "" "" 0 "My User Agent"
Sometimes when I start the script the icon turns red, but never does anything. I have to reboot my system and try again. Then it works. Should I put some type to Initialization statement in?
Posts: 12,072
Threads: 140
Joined: Dec 2002
It is known problem. Next QM version (2.1.8) or QM 2.1.9 will have more reliable internet functions.