C# Beispielcode
string parameters = String.Format("apicid={0}&apikey={1}&product={2}&firstname={3}&lastname={4}&street={5}&hno
={6}&zip={7}&city={8}&country={9}&phone={10}",
apicid, apikey, product,conna2, conna1,street, hno, zip, city, country, phone);
string response = AdressLaborWebRequest(parameters);
private string AdressLaborWebRequest(string parameter)
{
try
{
HttpWebRequest req = WebRequest.Create(new Uri("https://api.adresslabor.de/v1/de/check")) as HttpWebRequest;
req.KeepAlive = false;
// pass params to the service
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] para = Encoding.UTF8.GetBytes(parameter);
req.ContentLength = para.Length;
Stream strm = req.GetRequestStream();
strm.Write(para, 0, para.Length);
strm.Close();
// read response from the service
HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
StreamReader result = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);
string response = result.ReadToEnd();
result.Close();
resp.Close();
return response;
}
catch (WebException ex)
{
return "";
}
}