Downloads list of registered Domains in your account from NameSilo.com using your API key into active Excel sheet, then downloads expiration date for each of these domains.
Sub NameSilo_APICall_ListDomains()
'
Application.Calculation = xlCalculationManual
ActiveSheet.Range("C1", "G1").EntireColumn.ClearContents
ActiveSheet.Range("C5").Value = "ID"
ActiveSheet.Range("D5").Value = "Domain"
ActiveSheet.Range("E5").Value = "Ext"
ActiveSheet.Range("F5").Value = "$Renew"
ActiveSheet.Range("G5").Value = "Expires"
ActiveSheet.Range("D2").FormulaR1C1 = "=""My Domains (""&counta(R5c:R50000c)-1&"")"""
'
MyKey = "your_api_key_with_namesilo"
URL1 = "https://www.namesilo.com/api/listDomains?version=1&type=xml&key=" & MyKey
RettString = Navigate(CStr(URL1), "")
If InStr(1, RettString, " <code >300 </code >", vbTextCompare) = 0 Then GoTo ByeBye_Err
Found1 = 1
Do
Found1 = InStr(Found1, RettString, " <domain >", vbTextCompare)
If Found1 = 0 Then Exit Do
Dom1 = CutString(RettString, " <domain >", " </domains >", Found1)
If Dom1 = "" Then Exit Do
NewRow = CountColumnCells("C", , ShDNS.Name)
ThisDom = CutString(Dom1, , " </domain >")
ActiveSheet.Range("C5").Offset(NewRow, 0).Value = NewRow
ActiveSheet.Range("C5").Offset(NewRow, 1).Value = ThisDom
' Read Domain info
' Extract expiration date now
' https://www.namesilo.com/api/getDomainInfo?version=1&type=xml&key=fa09761c38f504fdb6561c07c&domain=7files.net
URL2 = "https://www.namesilo.com/api/getDomainInfo?version=1&type=xml&domain=" & ThisDom & "&key=" & MyKey
DomInfo = Navigate(CStr(URL2), "")
If InStr(1, DomInfo, " <code >300 </code >", vbTextCompare) = 0 Then GoTo NextDom
DomExp = CutString(DomInfo, " <expires >", " </expires >")
ActiveSheet.Range("C5").Offset(NewRow, 4).Value = DomExp
NextDom:
Found1 = Found1 + 5
Loop
ActiveSheet.Range("E6", "E" & 5 + NewRow).FormulaR1C1 = "=mid(rc[-1],search(""."",rc[-1])+1,500)"
ActiveSheet.Range("F6", "F" & 5 + NewRow).FormulaR1C1 = "=vlookup(rc[-1],c11:c15,3,false)"
GoTo ByeBye
ByeBye_Err:
MsgBox "Error!!!", vbCritical
ByeBye:
Application.Calculation = xlCalculationAutomatic
End Sub
'
Application.Calculation = xlCalculationManual
ActiveSheet.Range("C1", "G1").EntireColumn.ClearContents
ActiveSheet.Range("C5").Value = "ID"
ActiveSheet.Range("D5").Value = "Domain"
ActiveSheet.Range("E5").Value = "Ext"
ActiveSheet.Range("F5").Value = "$Renew"
ActiveSheet.Range("G5").Value = "Expires"
ActiveSheet.Range("D2").FormulaR1C1 = "=""My Domains (""&counta(R5c:R50000c)-1&"")"""
'
MyKey = "your_api_key_with_namesilo"
URL1 = "https://www.namesilo.com/api/listDomains?version=1&type=xml&key=" & MyKey
RettString = Navigate(CStr(URL1), "")
If InStr(1, RettString, " <code >300 </code >", vbTextCompare) = 0 Then GoTo ByeBye_Err
Found1 = 1
Do
Found1 = InStr(Found1, RettString, " <domain >", vbTextCompare)
If Found1 = 0 Then Exit Do
Dom1 = CutString(RettString, " <domain >", " </domains >", Found1)
If Dom1 = "" Then Exit Do
NewRow = CountColumnCells("C", , ShDNS.Name)
ThisDom = CutString(Dom1, , " </domain >")
ActiveSheet.Range("C5").Offset(NewRow, 0).Value = NewRow
ActiveSheet.Range("C5").Offset(NewRow, 1).Value = ThisDom
' Read Domain info
' Extract expiration date now
' https://www.namesilo.com/api/getDomainInfo?version=1&type=xml&key=fa09761c38f504fdb6561c07c&domain=7files.net
URL2 = "https://www.namesilo.com/api/getDomainInfo?version=1&type=xml&domain=" & ThisDom & "&key=" & MyKey
DomInfo = Navigate(CStr(URL2), "")
If InStr(1, DomInfo, " <code >300 </code >", vbTextCompare) = 0 Then GoTo NextDom
DomExp = CutString(DomInfo, " <expires >", " </expires >")
ActiveSheet.Range("C5").Offset(NewRow, 4).Value = DomExp
NextDom:
Found1 = Found1 + 5
Loop
ActiveSheet.Range("E6", "E" & 5 + NewRow).FormulaR1C1 = "=mid(rc[-1],search(""."",rc[-1])+1,500)"
ActiveSheet.Range("F6", "F" & 5 + NewRow).FormulaR1C1 = "=vlookup(rc[-1],c11:c15,3,false)"
GoTo ByeBye
ByeBye_Err:
MsgBox "Error!!!", vbCritical
ByeBye:
Application.Calculation = xlCalculationAutomatic
End Sub
Views 3,691
Downloads 1,299
CodeID
DB ID
ANmarAmdeen
602
Revisions
v1.0
Friday
May
25
2018