 |
1. Create a Confirmation Session:
1.1 GET:
Example:
String data = "uuid=" + settings.UserID + "&furl=" + settings.FinalURL + "&ph=" + txtPhone.Text.Trim() + "&type=" + settings.ValidationType + "&tid=" + settings.TemplateID;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://www.phoneconfirm.com/soap/HTTPHandlers/CreateConfirmationSession.aspx?" + data);
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
Stream resst = res.GetResponseStream();
StreamReader sr = new StreamReader(resst);
String response = sr.ReadToEnd();
|
1.2 POST: same as GET method, but parameters are transferred by POST method.
(The parameters are: User ID, Final URL, phone number, validation type, template ID)
Example:
String data = "uuid=" + settings.UserID + "&furl=" + settings.FinalURL + "&ph=" + txtPhone.Text.Trim() + "&type=" + settings.ValidationType + "&tid=" + settings.TemplateID;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://www.phoneconfirm.com/soap/HTTPHandlers/CreateConfirmationSession.aspx");
Byte[] buffer = Encoding.UTF8.GetBytes(data);
String proxy = null;
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = buffer.Length;
req.Proxy = new WebProxy(proxy, true); // ignore for local addresses
req.CookieContainer = new CookieContainer(); // enable cookies
Stream reqst = req.GetRequestStream(); // add form data to request stream
reqst.Write(buffer, 0, buffer.Length);
reqst.Flush();
reqst.Close();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
Stream resst = res.GetResponseStream();
StreamReader sr = new StreamReader(resst);
String response = sr.ReadToEnd();
|
1.3 SOAP: implement interfaces at http://www.phoneconfirm.com/soap/jobs.asmx (or refresh connection if already connected), then create a session using SOAP:
Example:
Jobs.Jobs job = new Jobs.Jobs();
Jobs.ConfirmationSessionUIDs result = job.CreateConfirmationSession(settings.UserID, settings.FinalURL, txtPhone.Text.Trim(), settings.ValidationType.ToString(), settings.TemplateID);
|
When successful, any of these methods will return an object containing 2 IDs (Session ID and Success ID). If a session can’t be created, the same object will be returned, but both IDs will be blank.
|
2. Validation:
Example:
Response.Redirect("http://phoneconfirm.com/validationphone.aspx?csuid=" + csuid + "&par1=" + txtFirstName + "&par2=" + txtLastName);
|
Where csuid is session ID (mandatory parameter), and par1, par2, par3, ... are optional, you can pass any information, it will be returned unchanged to the finalurl as a GET parameter.
|
3. Check ConfirmationSession status:
“csuid” is the ID for the session, it’s a mandatory parameter. It can be passed via GET or POST method.
Example:
String data = "csuid=" + txtID.Text.Trim();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://phoneconfirm.com/GetSessionStatus.aspx?" + data);
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
String xmlStatus = sr.ReadToEnd();
|
The result being that any of the methods will return an object containing a string with status; if the session isn’t found the status will read “Session not found”.
|
|
|