Jump to content
Bouhlal

ICS Whois Client

Recommended Posts

Hello

how can i extract the Expiry date of a domain name in ICS Whois Client component, I want to show it in edit.text

Best Regards

Share this post


Link to post

The Whois result is always free text, and varies between registrars.  But usually you'll see something like:

 

One example:

   Updated Date: 2020-10-30T06:00:11Z
   Creation Date: 2020-10-30T06:00:08Z
   Registry Expiry Date: 2021-10-30T06:00:08Z
   Registrar: NameCheap, Inc.
  

My own domain (very old): 

    Relevant dates:
        Registered on: before Aug-1996
        Expiry date:  02-Sep-2022
        Last updated:  03-Aug-2020

 

so you just search for that expiry line and get the date, allowing for various formats.  You need to check several domains for different formats. 

 

If you manage to collerct all this information and parse it sensibly, we could add it to the component for others.  I'd particular like domain registered date, because most spam comes from newly registered domains.

 

Angus

 

Share this post


Link to post

Hello

thank you for  the quick answer,

I want to create a mobile app that monitor my domains and notify me when the expiry date come,

I tried    

 

Quote

posi:=ansipos('Registry Expiry Date:', memo1.text);
  edit3.Text:=posi.tostring;

but the problem is every registrar has his own name for expiry date like domain .ru has PAID-TILL instead of expiry date .

created:       2019-10-31T10:58:07Z
paid-till:     2021-10-31T10:58:07Z
free-date:     2021-12-01

so I need an easy why to get the expiration date in edit.text so I can make a notification for the expiration date for each domains

Best regards

 

Share this post


Link to post
3 hours ago, Bouhlal said:

how can i extract the Expiry date of a domain name in ICS Whois Client component, I want to show it in edit.text

Why are you asking this again?  Why are you creating different accounts across the Internet just to ask the same question over and over?  You have already been told several times before, in other forums (here and here), that the WHOIS protocol simply does not work the way you are asking for, regardless of which socket library you use to send the query.  You have to retrieve the entire WHOIS data and parse it yourself to get the data you want from it, there is no other option.

Edited by Remy Lebeau

Share this post


Link to post
2 hours ago, Bouhlal said:

the problem is every registrar has his own name for expiry date like domain .ru has PAID-TILL instead of expiry date .

There is no standard format for WHOIS data.  You are just going to have to check the retrieved data for multiple formats until you find one that matches.  For example, I would suggest using a TStringList, eg:

const
  FieldNames: array[0..2] of string = ('Registry Expiry Date', 'Expiry date', 'paid-till');
var
  sl: TStringList;
  I: Integer;
  expiry: string;
begin
  sl := TStringList.Create;
  try
    sl.Assign(Memo1.Lines);
    for I := 0 to sl.Count-1 do begin
      sl[I] := TrimLeft(sl[I]);
    end;
    sl.NameValueSeparator := ':';
    for I := Low(FieldNames) to High(FieldNames) do begin
      expiry := Trim(sl.Values[FieldNames[I]]);
      if expiry <> '' then Break;
    end;
  finally
    sl.Free;
  end;
  Edit3.Text := expiry;
end;

 

Edited by Remy Lebeau

Share this post


Link to post

Hello

first of all, i thank you for the example, I have asked many times for 2 things :

1st i don't know how to parse it, because I'm newbie.

2nd i have lost many domains because I have a lot of and some time I don't pay attention to the expiry date and o lot it and I would like to create mobile app that send me notification for every domain, I have search on playstore but didn't find one that meet my need.

thank you again

Best Regards

Share this post


Link to post
On 2/13/2021 at 2:24 PM, Bouhlal said:

i don't know how to parse it, because I'm newbie

The instead of asking always the same question, retrieve the whole data and then ask a specific question related to parsing text data. That new question should NOT even mention WHOIS nor ICS since it is related to parsing text data. And do NOT ask this question here in ICS dedicated forum, ask in a general purpose forum (Could be on DelphiPraxis other forum or StackOverflow). One last recommendation: Do NOT create new accounts here and there you will just makes people angry (That's mostly the same people answering everywhere and they will recognize you).

Share this post


Link to post

The TIcsWhoisCli component already parses the response in the AutoQueryResponse function, looking for a secondary Whois server using several different phrases.  Extracting more information is trivial, although tedious having to research lots of responses to know the different whois response formats.

 

Angus

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×