Re: [WebDNA] anyone have a good tcpconnect post snippet?
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 102785
interpreted = N
texte = Hi Stuart,Thanks for the snippet, it looks like one of the snippets Christophe sent me yesterday. I'm doing a PayPal post too but I think I'm using their simplest API which is a bit different from the one you're using.I took your examples as a starting point then I put all the variables above the tcpconnect code to separate them from the code that actually does the work. I haven't tested it yet but I think it will work unless host or path are reserved webdna variables but I don't think they are:[text]host=www.paypal.com[/text][text]path=/cgi-bin/webscr[/text][text]crlf=[unurl]%0D%0A[/unurl][/text][text]content=... name=value pairs here ...[/text][tcpconnect host=[host]&port=443&ssl=T][tcpsend skipheader=T]POST [path] HTTP/1.0[crlf][!][/!]USER-AGENT: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)[crlf][!][/!]Content-Type: text/namevalue[crlf][!][/!]Content-Length: [countchars][content][/countchars][crlf][crlf][!][/!][content][crlf][!][/!][/tcpsend][/tcpconnect]BTW, is there a list of reserved webdna variables available somewhere? I thought I saw some talk about this recently but I don't remember the outcome.Sincerely,Ken Grome> Here is some code I have C&P from a PayPal snippet I> have, I know you will be able to sort out the sheep from> the goats :)>> [!]===== SetExpressCheckout =====[/!]> [TEXT show=T]content=[!]> [/!]&USER=[URL][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIUSERNAME][/URL][!]> [/!]&PWD=[URL][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIPASSWORD][/URL][!]> [/!]&VERSION=[URL][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIVERSION][/URL][!]> [/!]&SIGNATURE=[URL][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APISIGNATURE][/URL][!]> [/!]&METHOD=[URL]SetExpressCheckout[/URL][!]> [/!]&PAYMENTACTION=[URL]SALE[/URL][!] SALE,> AUTHORIZATION, ORDER [/!]&AMT=[URL][_amount][/URL][!]> [/!]&CURRENCYCODE=[URL][ThisCurrency][/URL][!]> [/!]&SOLUTIONTYPE=[URL]Sole[/URL][!]> [/!]&RETURNURL=[URL][SiteReturnURL][/URL][!]> [/!]&CANCELURL=[URL][SiteCancelURL][/URL][!]> [/!]&INVNUM=[URL][ThisOrder][/URL][!]> [/!]&PAGESTYLE=[URL][ThisBrand][/URL][!]> [/!][/TEXT]>> [!]===== Make Connection =====[/!]> [text muti=F]paypal_result=[tcpconnect host=[Lookup> db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIURL]&port=443&ssl=T][!]> [/!][tcpsend skipheader=T]POST /nvp> HTTP/1.0[UnURL]%0D%0A[/UnURL][!] [/!]USER-AGENT:> Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)> [UnURL]%0D%0A[/UnURL][!]> [/!]Content-type: text/namevalue[UnURL]%0D%0A[/UnURL][!]> [/!]Content-Length:> [CountChars][content][/CountChars][UnURL]%0D%0A[/> UnURL][!]> [/!]Content-type: text/namevalue[UnURL]%0D%0A[/UnURL][!]> [/!][UnURL]%0D%0A[/UnURL][!]> [/!][content][UnURL]%0D%0A[/UnURL][!]> [/!][/TCPSend][!]> [/!][/tcpconnect][/text]>>> Regards>> Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au
Associated Messages, from the most recent to the oldest:
Hi Stuart,Thanks for the snippet, it looks like one of the snippets Christophe sent me yesterday. I'm doing a PayPal post too but I think I'm using their simplest API which is a bit different from the one you're using.I took your examples as a starting point then I put all the variables above the tcpconnect code to separate them from the code that actually does the work. I haven't tested it yet but I think it will work unless host or path are reserved webdna variables but I don't think they are:
[text]host=www.paypal.com[/text]
[text]path=/cgi-bin/webscr[/text]
[text]crlf=
[unurl]%0D%0A[/unurl][/text]
[text]content=... name=value pairs here ...[/text][tcpconnect host=[host]&port=443&ssl=T][tcpsend skipheader=T]POST [path] HTTP/1.0[crlf]
[!][/!]USER-AGENT: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)[crlf]
[!][/!]Content-Type: text/namevalue[crlf]
[!][/!]Content-Length:
[countchars][content][/countchars][crlf][crlf]
[!][/!][content][crlf]
[!][/!][/tcpsend][/tcpconnect]BTW, is there a list of reserved webdna variables available somewhere? I thought I saw some talk about this recently but I don't remember the outcome.Sincerely,Ken Grome> Here is some code I have C&P from a PayPal snippet I> have, I know you will be able to sort out the sheep from> the goats :)>>
[!]===== SetExpressCheckout =====[/!]> [TEXT show=T]content=
[!]> [/!]&USER=
[url][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIUSERNAME][/URL]
[!]> [/!]&PWD=
[url][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIPASSWORD][/URL]
[!]> [/!]&VERSION=
[url][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIVERSION][/URL]
[!]> [/!]&SIGNATURE=
[url][Lookup db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APISIGNATURE][/URL]
[!]> [/!]&METHOD=
[url]SetExpressCheckout[/URL]
[!]> [/!]&PAYMENTACTION=
[url]SALE[/URL]
[!] SALE,> AUTHORIZATION, ORDER [/!]&AMT=
[url][_amount][/URL]
[!]> [/!]&CURRENCYCODE=
[url][ThisCurrency][/URL]
[!]> [/!]&SOLUTIONTYPE=
[url]Sole[/URL]
[!]> [/!]&RETURNURL=
[url][SiteReturnURL][/URL]
[!]> [/!]&CANCELURL=
[url][SiteCancelURL][/URL]
[!]> [/!]&INVNUM=
[url][ThisOrder][/URL]
[!]> [/!]&PAGESTYLE=
[url][ThisBrand][/URL]
[!]> [/!][/TEXT]>>
[!]===== Make Connection =====[/!]> [text muti=F]paypal_result=[tcpconnect host=[Lookup> db=^paypal/> paypal.db&Lookinfield=PREF&returnfield=PREFVALUE&value=[A>PI- CODE]APIURL]&port=443&ssl=T]
[!]> [/!][tcpsend skipheader=T]POST /nvp> HTTP/1.0
[unurl]%0D%0A[/UnURL]
[!] [/!]USER-AGENT:> Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)>
[unurl]%0D%0A[/UnURL]
[!]> [/!]Content-type: text/namevalue
[unurl]%0D%0A[/UnURL]
[!]> [/!]Content-Length:>
[countchars][content][/CountChars]
[unurl]%0D%0A[/> UnURL]
[!]> [/!]Content-type: text/namevalue
[unurl]%0D%0A[/UnURL]
[!]> [/!]
[unurl]%0D%0A[/UnURL]
[!]> [/!][content]
[unurl]%0D%0A[/UnURL]
[!]> [/!][/TCPSend]
[!]> [/!][/tcpconnect][/text]>>> Regards>> Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au
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:
[TaxableTotal] - not working with AOL and IE (1997)
Problems with [Applescript] (1997)
shownext (1997)
[WebDNA] TCPConnect/cURL alternative for windows? (2010)
Refreshing document (2000)
I've been thinking (2002)
Encyption mail (1998)
WC 4.0 on OSX 10.0.4 problems (2001)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
Req: Array Tags Explained, simple and clear (2004)
Is this possible, WebCat2.0 and checkboxes (1997)
Bug Report, maybe (1997)
First n words (2000)
Mac GUI editors (1997)
Logging purchases (1997)
Auto Delete EmailCompleted Files (2002)
plugin-acgi, different results (1997)
WebCat2 - Getting to the browser's username/password data (1997)
listfiles shows invisible files ... (1999)
Erotic Sites (1997)