Below you find an ASP script example on how to retrieve the list of newsgroups from a NNTP Server.
Please have a look at the NNTP Monitor as well please.

To try it out just go to http://www.aloaha.com/api/newslist.php?NSERVER=news.microsoft.com
Please excuse if the link above is slow. It not running on my server but on a customer machine.

 

'Copyright 2005 by www.aloaha.com
'furhter questions please send to info@aloaha.com or visit our Forum at:
'http://www.aloaha.com/html/portal

 

<% @Language = "VBScript" %>
<%
'Copyright 2005 www.aloaha.com
'coded by Frank Hellmann
'frank.hellmann@aloaha.com

on error resume next
Response.buffer = false
Response.Expires = -1
Server.ScriptTimeout = 30

%>

<html>
<head>

<%

On Error Resume Next
'declare objects
dim news
dim problem
problem = 0
dim dummy
dim getfrom
dim subject
dim nname
dim darray
dim i
'create object
err.clear
subject=""
Set news=CreateObject("pop3news.popnews")

if err.number=0 then
getfrom=""
'set getfrom
if instr(Request.QueryString("getfrom"),".")> 0 then
getfrom=Request.QueryString("getfrom")
end if


if instr(Request.QueryString("GETFROM"),".")> 0 then
getfrom=Request.QueryString("GETFROM")
end if


if getfrom<>"" then
'Set server and port
news.remotehost="news.microsoft.com"
if instr(Request.QueryString("NSERVER"),".")> 0 then
news.remotehost=Request.QueryString("NSERVER")
end if


if instr(Request.QueryString("nserver"),".")> 0 then
news.remotehost=Request.QueryString("nserver")
end if
news.remoteport="119"

'choose newsgroup
dummy=news.getgroups
darray=split(dummy,vbcrlf)
else
problem = 2
end if
else
problem = 1
end if

if subject="" then subject="news.microsoft.com"
%>

<title><% response.write subject %> News List</title>
</head>
<body>

<%

if problen = 0 then
for i = 0 to ubound(darray)
if len(darray(i))>0 then
if ubound(split(darray(i)))=3 then
nname = split(darray(i))(0)
if len(nname)>0 then
response.write "<a href='"&getfrom&"?NSERVER="&news.remotehost&"&NGROUP="&nname&"'>"&nname&"</a><br>"
end if
end if
end if
next

else
if problem = 2 then
response.write "<BR><CENTER>getfrom parameter not specified</CENTER><BR>"
else
response.write "<BR><CENTER>Problems loading the NNTP Object</CENTER><BR>"
end if
end if
%>

</body>
</html>

<%
On Error Resume Next

'destroy Object
Set news=Nothing
%>

 

Back to Index