50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
IMPORT com
|
|
DEFINE url,res STRING,
|
|
ret int
|
|
|
|
MAIN
|
|
|
|
LET url = 'urlhttps://api.hunter.io/v2/email-verifier?email=etovar@stonemarketsa.com&api_key=2a50343f3a2842b082ee2c4b3ecccaf4ae5a7766'
|
|
|
|
CALL ipquality_send_command(url) RETURNING ret,res
|
|
|
|
DISPLAY res
|
|
|
|
|
|
END MAIN
|
|
|
|
|
|
FUNCTION ipquality_send_command(url)
|
|
|
|
DEFINE url, cmd STRING
|
|
DEFINE result, tmp STRING
|
|
DEFINE http_req com.HTTPRequest
|
|
DEFINE http_resp com.HTTPResponse
|
|
|
|
|
|
DISPLAY "url", url
|
|
TRY
|
|
LET http_req = com.HTTPRequest.Create(url)
|
|
CALL http_req.setHeader("apikey","cHZNnfXkbJDtx43YcrQqHSjXzBrndwT3")
|
|
|
|
CALL http_req.doRequest()
|
|
|
|
LET http_resp=http_req.getResponse()
|
|
|
|
IF http_resp.getStatusCode() != 200 THEN
|
|
RETURN http_resp.getStatusCode(), http_resp.getStatusDescription()
|
|
END IF
|
|
LET tmp = http_resp.getStatusDescription()
|
|
IF (tmp == "OK" || tmp == "no error" ) THEN
|
|
RETURN -1, SFMT("HTTP request status description: %1 ",tmp)
|
|
END IF
|
|
LET result = http_resp.getTextResponse()
|
|
CATCH
|
|
RETURN -2, SFMT("HTTP request error: STATUS=%1 (%2)",STATUS,SQLCA.sqlerrd[2])
|
|
END TRY
|
|
|
|
|
|
RETURN 0, result
|
|
|
|
END FUNCTION
|