C
colleen1980
Hi: When i run the same code with minor changes in VB it works fine
but when i run in ASP it runs but it not pulling any information from
the web site. Needs help
Thanks,
Anna.
ASP CODE
Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-"
vFile = vFile & year(now) & month(now) & day(now) & "-"
vFile = vFile & hour(now) & minute(now) & second(now) & ".html"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data
Source=dec1"
sSQL = "select name1,ssn1 from dbtr where status_code=450"
Set rs = DBConn.Execute(sSQL)
Set objFile = objFSO.OpenTextFile(vfile, ForAppend, True)
Do While Not rs.EOF
social = rs.Fields("ssn1")
'objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/
ssdi.cgi", social)
response.write(rs.Fields("ssn1"))
response.write("<br>")
rs.moveNext
loop
Function PostURL(sURL, aPostData)
Dim XmlHTTP
Set XmlHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
With XmlHTTP
.Open "POST", sURL, False
.setRequestHeader "Content-Type", "application/ x-www-form-
urlencoded"
.Send aPostData
If .Status = 200 Then
PostURL = .responseText
Else
PostURL = "Error!"
End If
End with
Set XmlHTTP = Nothing
End Function
VB PROGRAM
Private Sub deceasedProcess()
Dim social As String, WShell As Object, vpath As String, vfile
Set WShell = CreateObject("wscript.shell")
vpath = WShell.SpecialFolders("MyDocuments") & "\"
vfile = vpath & "Deceased-Information-" & Format$(Now, "yyyymmdd-
hhmmss") & ".html"
Dim ssnFile As String, xLine
ssnFile = "C:\ssn.txt"
Open ssnFile For Input As #2
Do While Not EOF(2)
Line Input #2, xLine
social = Trim(xLine)
Open vfile For Append As #1
Print #1, PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn="
& social)
Close #1
Loop
Close #2
Set WShell = Nothing
End Sub
ssn.txt
but when i run in ASP it runs but it not pulling any information from
the web site. Needs help
Thanks,
Anna.
ASP CODE
Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-"
vFile = vFile & year(now) & month(now) & day(now) & "-"
vFile = vFile & hour(now) & minute(now) & second(now) & ".html"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data
Source=dec1"
sSQL = "select name1,ssn1 from dbtr where status_code=450"
Set rs = DBConn.Execute(sSQL)
Set objFile = objFSO.OpenTextFile(vfile, ForAppend, True)
Do While Not rs.EOF
social = rs.Fields("ssn1")
'objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/
ssdi.cgi", social)
response.write(rs.Fields("ssn1"))
response.write("<br>")
rs.moveNext
loop
Function PostURL(sURL, aPostData)
Dim XmlHTTP
Set XmlHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
With XmlHTTP
.Open "POST", sURL, False
.setRequestHeader "Content-Type", "application/ x-www-form-
urlencoded"
.Send aPostData
If .Status = 200 Then
PostURL = .responseText
Else
PostURL = "Error!"
End If
End with
Set XmlHTTP = Nothing
End Function
VB PROGRAM
Private Sub deceasedProcess()
Dim social As String, WShell As Object, vpath As String, vfile
Set WShell = CreateObject("wscript.shell")
vpath = WShell.SpecialFolders("MyDocuments") & "\"
vfile = vpath & "Deceased-Information-" & Format$(Now, "yyyymmdd-
hhmmss") & ".html"
Dim ssnFile As String, xLine
ssnFile = "C:\ssn.txt"
Open ssnFile For Input As #2
Do While Not EOF(2)
Line Input #2, xLine
social = Trim(xLine)
Open vfile For Append As #1
Print #1, PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn="
& social)
Close #1
Loop
Close #2
Set WShell = Nothing
End Sub
ssn.txt