[WebDNA] Sage code: use curl instead of tcpconnect
This WebDNA talk-list message is from 2018
It keeps the original formatting.
numero = 114325
interpreted = N
texte = 1940For anyone who needs it, this code creates POST data for myclient's Sage credit card transactions:[text]sageContent=[!][/!]M_ID=[ourSageID][!][/!]&M_Key=[ourSageKey][!][/!]&T_code=[ourTransactionCode][!][/!]&T_orderNum=[ourOrderNumber][!][/!]&T_amt=[sagePostAmt][!][/!]&C_name=[sagePostName][!][/!]&C_address=[sagePostAddress][!][/!]&C_city=xxxx[!][/!]&C_state=xx[!][/!]&C_zip=[sagePostZip][!][/!]&C_country=us[!][/!]&C_email=bogus@bogus.com[!][/!]&C_cardnumber=[sagePostCardNumber][!][/!]&C_exp=[sagePostExp][!][/!]&C_cvv=[sagePostCVV][!][/!][/text]And this code was previously used to submit the above data to Sagefrom one of my client's WebDNA 8.5.1 servers before it broke on06/25/2018 when Sage upgraded to TLS 1.2:[text]sageReply=[!][/!][tcpconnect host=sagepayments.net&port=443&ssl=T][!][/!][tcpsend skipheader=T]POST /cgi-bin/eftBankcard.dll[!][/!]?transaction HTTP/1.0[n][!][/!]Content-Type: application/x-www-form-urlencoded[n][!][/!]Content-Length:[countchars][sageContent][/countchars][n][n][!][/!][sageContent][n][!][/!][/tcpsend][!][/!][/tcpconnect][!][/!][/text]So now I use this code which replaces the tcpconnect on myclient's Ubuntu 16.04 server, and so far it works perfectly:[text]sageReply=[!][/!][shell]curl -d "[sageContent]" --tlsv1.2 POST [!][/!]https://sagepayments.net/cgi-bin/eftBankcard.dll[!][/!]?transaction[/shell][!][/!][/text]THEREFORE:If my use of "HTTP/1.0" is not causing the above tcpconnect tofail, then maybe tcpconnect simply does not work in WebDNA 8.5.1and earlier when POSTing data to a server that requires TLS 1.2.The curl code is much simpler anyways. Curl uses the"x-www-form-urlencoded" content type by default, and there's noneed to count characters in curl POST data or specify a HTTP version.:)Regards,Kenneth GromeWebDNA Solutionshttp://www.webdnasolutions.comWeb Database Systems and Linux Server Administration---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=55Bug Reporting: support@webdna.us.
Associated Messages, from the most recent to the oldest:
| |
- [WebDNA] Sage code: use curl instead of tcpconnect (Kenneth Grome 2018)
|
1940For anyone who needs it, this code creates POST data for myclient's Sage credit card transactions:
[text]sageContent=
[!][/!]M_ID=[ourSageID]
[!][/!]&M_Key=[ourSageKey]
[!][/!]&T_code=[ourTransactionCode]
[!][/!]&T_orderNum=[ourOrderNumber]
[!][/!]&T_amt=[sagePostAmt]
[!][/!]&C_name=[sagePostName]
[!][/!]&C_address=[sagePostAddress]
[!][/!]&C_city=xxxx
[!][/!]&C_state=xx
[!][/!]&C_zip=[sagePostZip]
[!][/!]&C_country=us
[!][/!]&C_email=bogus@bogus.com
[!][/!]&C_cardnumber=[sagePostCardNumber]
[!][/!]&C_exp=[sagePostExp]
[!][/!]&C_cvv=[sagePostCVV]
[!][/!][/text]And this code was previously used to submit the above data to Sagefrom one of my client's WebDNA 8.5.1 servers before it broke on06/25/2018 when Sage upgraded to TLS 1.2:
[text]sageReply=
[!][/!][tcpconnect host=sagepayments.net&port=443&ssl=T]
[!][/!][tcpsend skipheader=T]POST /cgi-bin/eftBankcard.dll
[!][/!]?transaction HTTP/1.0[n]
[!][/!]Content-Type: application/x-www-form-urlencoded[n]
[!][/!]Content-Length:
[countchars][sageContent][/countchars][n][n]
[!][/!][sageContent][n]
[!][/!][/tcpsend]
[!][/!][/tcpconnect]
[!][/!][/text]So now I use this code which replaces the tcpconnect on myclient's Ubuntu 16.04 server, and so far it works perfectly:
[text]sageReply=
[!][/!]
[shell]curl -d "[sageContent]" --tlsv1.2 POST
[!][/!]https://sagepayments.net/cgi-bin/eftBankcard.dll
[!][/!]?transaction[/shell]
[!][/!][/text]THEREFORE:If my use of "HTTP/1.0" is not causing the above tcpconnect tofail, then maybe tcpconnect simply does not work in WebDNA 8.5.1and earlier when POSTing data to a server that requires TLS 1.2.The curl code is much simpler anyways. Curl uses the"x-www-form-urlencoded" content type by default, and there's noneed to count characters in curl POST data or specify a HTTP version.:)Regards,Kenneth GromeWebDNA Solutionshttp://www.webdnasolutions.comWeb Database Systems and Linux Server Administration---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list talk@webdna.usTo unsubscribe, E-mail to: talk-leave@webdna.usarchives: http://www.webdna.us/page.dna?numero=55Bug Reporting: support@webdna.us.
Kenneth Grome
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[WebDNA] Download page (2017)
Banner Ads (2000)
[WebDNA] Best practice re: password storage (2013)
[WebDNA] TLS 1.2 and [tcpconnect] (2018)
WebCat b13 CGI -shownext- (1997)
taxrate - off by 1 cent (1997)
PCS Frames-Default page is solution! (1997)
Re(7): Small Bug: ErrorLog.txt/[FORMVARIABLES]/[ORDERFILE] (1998)
[sendmail] (2000)
Seeking Better Display of results... (1997)
encrypt/decrypt (2001)
WebCatalog Technical Reference (1997)
New to WebCat, Help. (1998)
'Sorry WebDNA server not running.' error (2002)
Frames and WebCat (1997)
If set cookie doesn't work. (2000)
WC2b15 File Corruption (1997)
passing along TextB (1999)
Rubbish in form fields (2004)
Re2: frames & carts (1997)