I am trying to read data from this link to check domain availability :
private bool DomainAvailble(string domain)
{
string response = "";
StreamReader objReader;
string sURL;
sURL = "https://testapi.internet.bs/Domain/Check?ApiKey=testapi&Password=testpass&Domain=" + domain;
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
try
{
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
objReader = new StreamReader(objStream);
response = objReader.ReadToEnd();
objReader.Close();
objReader.Dispose();
}
catch (Exception ex)
{
ex.ToString();
}
var test = response.ToArray();
if (ContainsInvariant(response, "nstatus=AVAILABLE"))
return true;
else
return false;
}
private bool ContainsInvariant(string sourceString, string filter)
{
return sourceString.ToLowerInvariant().Contains(filter);
}
but this code is not working, but i can read the result as :
transactid=860d5feb048352ae25b8bd4134a4910b\nstatus=UNAVAILABLE\ndomain=common.com\nminregperiod=1Y\nmaxregperiod=10Y\nregistrarlockallowed=YES\nprivatewhoisallowed=YES\nrealtimeregistration=YES
What is the way to read the status of whether a domain is available or not on this result, and is there a way where I can read each value?