T
tbergman
Guest
Here's some code I recently wrote to talk to Google for CAPTCHA verification. It posts using the .Net HttpClient. Hopefully this will be enough to get you started. USING System.Net.Http.*. USING System.Collections.Generic.*. USING Progress.Lang.*. USING Progress.Json.ObjectModel.*. METHOD PUBLIC LOGICAL VerifyCaptcha( INPUT CaptchaResponse AS CHARACTER, INPUT IPAddress AS CHARACTER ): DEFINE VARIABLE Client AS HttpClient. DEFINE VARIABLE Response AS HttpResponseMessage. DEFINE VARIABLE JsonParser AS ObjectModelParser. DEFINE VARIABLE ValuesCollection AS "Dictionary ". JsonParser = NEW ObjectModelParser(). Client = NEW HttpClient(). Client:BaseAddress = NEW System.Uri(" www.google.com/.../siteverify") . ValuesCollection = NEW "Dictionary "(). ValuesCollection:Add("secret","xxxxxxx"). ValuesCollection:Add("response",CaptchaResponse). ValuesCollection:Add("remoteip",IPAddress). Response = Client
ostAsync( "", NEW FormUrlEncodedContent(ValuesCollection)) :Result. CaptchaResponse = Response:Content:ReadAsStringAsync():RESULT. IF CAST(JsonParser
arse(CaptchaResponse),JsonObject):GetLogical("success") THEN RETURN TRUE. ELSE RETURN FALSE. END METHOD.
Continue reading...


Continue reading...