Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with macro that posts data to perl script
#1
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?
#2
This should work, although not tested. Requires QM 2.1.5 or later.

Code:
Copy      Help
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
#3
Is it possible to modify the code to use the post method instead of using the get method?
#4
IntPost uses POST method. IntGetFile uses GET method, where variables are appended to url.
#5
I appreciate your help, and almost have it working. One last question. How can i modify the result to only have digits?
#6
What are result and result2 now?
#7
result comes back as

&request=463696683719461691685641&

I need to resubmit only the number
#8
Code:
Copy      Help
result.get(result 9 result.len-10)
#9
Finally how can i write the results to a file. Thanks
#10
result2.setfile(...)
#11
Is it possible to change the user agent from quick marcos?
#12
Insert this somewhere before first IntPost

Code:
Copy      Help
IntSettings 0 "" "" 0 "My User Agent"
#13
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?
#14
It is known problem. Next QM version (2.1.8) or QM 2.1.9 will have more reliable internet functions.


Forum Jump:


Users browsing this thread: 1 Guest(s)