"https://api.gumroad.com/v2/licenses/verify -d 'product_id=" + product + "' -d 'license_key=" + licenseVal + "' -X POST"
I have this curl string above, how would I run it? I’m not super well versed in Curl to begin with so apologies if this is simple. I tried a few examples modifying them to fit how my project is structured but I just get a null response.
Var curl As New CURLSMBS
// collect output as we don't have events to handle it right away
curl.CollectDebugMessages = True
curl.CollectOutputData = True
curl.CollectHeaders = True
// write debug log
curl.OptionVerbose = True
// download here
curl.OptionURL = command // <-this is the curl string
Var errorCode As Integer = curl.Perform
// check result
Var outPut As String = curl.OutputData
Var DebugMessage As String = curl.DebugMessages // check in debugger on error
If(errorCode <> 0) Then
Add a line before calling Perform like this:
curl.OptionPostFields = "product_id=" + product + "&license_key=" + licenseVal
Fun tip, almost every CURL example can be turned into a framework URLConnection. There isn’t a need to use plugins to interact with REST APIs.
Since your API takes form-data we will use einhugur/MultipartFormContent
var oSock as new URLConnection
var oBody as new MultipartFormDataContent
// This sets the body content that CURL -d does
// SendSync is really bad for building entire applications with
// It is only used here as a quick-n-dirty example
var sResposne as String = oSock.SendSync("POST", "https://api.gumroad.com/v2/licenses/verify")
If you’re doing something more than a simple quick fetch like this, I would recommend switching to the asynchronous
Send. That doesn’t make for easily pastable forum-code though
I figured there was a way to do it without the plugin but might as well “smoke em if you got em”.
Thanks for the alternative method though!