Trying to turn this code created by the curl genie into a function that can be called from the browser like this video explains https://www.youtube.com/watch?v=BOUrEhYfZBk&t=186s
not sure how you would code?
Function plan as c ()
Plan = ?
end Function
exports.create_plan = plan
not sure how you would code?
Function plan as c ()
Plan = ?
end Function
exports.create_plan = plan
dim cf_1 as extension::CurlFile
dim flag_1 as l
dim ce as extension::Curl
ce = extension::Curl.Init()
ce.setOpt("URL","https://api.stripe.com/v1/plans")
ce.setOpt("NOPROGRESS",1)
ce.setOpt("USERPWD","sk_test_9L3BgxHETEMrKjLa85yT2kzE:")
dim posted_fields as c = ("amount=7500&interval=month&product[name]=Iorp¤cy=usd&id=Iorp")
ce.setOpt("POSTFIELDS",posted_fields)
ce.setOpt("POSTFIELDSIZE_LARGE", len(posted_fields) )
ce.setOpt("USERAGENT","curl/7.34.0")
ce.setOpt("MAXREDIRS",50)
ce.setOpt("CAINFO",a5.Get_Exe_Path()+"\caroot\ca-cert.pem")
ce.setOpt("CAPATH",a5.Get_Exe_Path()+"\caroot")
'ce.setOpt("SSH_KNOWNHOSTS","C:\Users\Robert Senski\AppData\Roaming/_ssh/known_hosts")
ce.setOpt("TCP_KEEPALIVE",1)
ce.SetOpt("FILE",cf_1)
flag_1 = ce.Exec()
ce.setOpt("URL",<<%txt%
\
%txt%)
if flag_1 then
dim headers as c
dim contents as c
headers = cf_1.GetHeaders()
contents = cf_1.GetContent()
'BE SURE TO COMMENT OUT THIS CODE IN A WEB APPLICATION AS showVar() CANNOT BE USED IN WEB APPLICATIONS
dim msg as c
msg = "Headers: " + crlf() + headers + crlf() + "Content: " + contents
showvar(msg)
else
dim errors as c
errors = ce.error()
'BE SURE TO COMMENT OUT THIS CODE IN A WEB APPLICATION AS showVar() CANNOT BE USED IN WEB APPLICATIONS
showvar("error: " + errors)
end if
ce.close()
dim flag_1 as l
dim ce as extension::Curl
ce = extension::Curl.Init()
ce.setOpt("URL","https://api.stripe.com/v1/plans")
ce.setOpt("NOPROGRESS",1)
ce.setOpt("USERPWD","sk_test_9L3BgxHETEMrKjLa85yT2kzE:")
dim posted_fields as c = ("amount=7500&interval=month&product[name]=Iorp¤cy=usd&id=Iorp")
ce.setOpt("POSTFIELDS",posted_fields)
ce.setOpt("POSTFIELDSIZE_LARGE", len(posted_fields) )
ce.setOpt("USERAGENT","curl/7.34.0")
ce.setOpt("MAXREDIRS",50)
ce.setOpt("CAINFO",a5.Get_Exe_Path()+"\caroot\ca-cert.pem")
ce.setOpt("CAPATH",a5.Get_Exe_Path()+"\caroot")
'ce.setOpt("SSH_KNOWNHOSTS","C:\Users\Robert Senski\AppData\Roaming/_ssh/known_hosts")
ce.setOpt("TCP_KEEPALIVE",1)
ce.SetOpt("FILE",cf_1)
flag_1 = ce.Exec()
ce.setOpt("URL",<<%txt%
\
%txt%)
if flag_1 then
dim headers as c
dim contents as c
headers = cf_1.GetHeaders()
contents = cf_1.GetContent()
'BE SURE TO COMMENT OUT THIS CODE IN A WEB APPLICATION AS showVar() CANNOT BE USED IN WEB APPLICATIONS
dim msg as c
msg = "Headers: " + crlf() + headers + crlf() + "Content: " + contents
showvar(msg)
else
dim errors as c
errors = ce.error()
'BE SURE TO COMMENT OUT THIS CODE IN A WEB APPLICATION AS showVar() CANNOT BE USED IN WEB APPLICATIONS
showvar("error: " + errors)
end if
ce.close()
Comment