thank you in advance. Can anyone help me with this problem, i need to get the value from the callback URL. The callback URL look like this. that parameters from the callback URL is sent by the third party.
"https://www.viewmyrecord.com/Texting/GetReply.asp?from=1561234567&to=15698745642&text=Hi
Kid,Reminder November 22, 2019 w/ REN, MD at 11:00 am&datetime=Nov 11 2019 10:17PM&cost=0.00"
I need to parse the value of "from","to","text","datetime" and "cost". And save it to text file. I don't have any idea about this. but my "GetReply.asp" looks like this.
<%
If Request.TotalBytes > 0 Then
Dim lngBytesCount,try
lngBytesCount = Request.TotalBytes
Response.Write BytesToStr(Request.BinaryRead(lngBytesCount))
dim fs,tfile,loc,locadd,loctime,loctime1,nameFile,datename
datDate = Now()
locadd = Trim(FormatDateTime(datDate, 1))
loctime = FormatDateTime(datDate, 4)
loctime1 = stripNonNumeric(FormatDateTime(Now, 3))
nameFile = "\\85new\Accts85new\Texting\Reply\"
datename = Trim(loctime1&"-"&locadd&".txt")
loc = "\\85new\Accts85new\Texting\Reply\"&loctime1&"-"&locadd&".txt"
set fs=Server.CreateObject("Scripting.FileSystemObject")
set tfile=fs.CreateTextFile(loc)
tfile.WriteLine(try)
tfile.close
set tfile=nothing
set fs=nothing
end if
Function BytesToStr(bytes)
Dim Stream
Set Stream = Server.CreateObject("Adodb.Stream")
Stream.Type = 1 'adTypeBinary
Stream.Open
Stream.Write bytes
Stream.Position = 0
Stream.Type = 2 'adTypeText
Stream.Charset = "iso-8859-1"
BytesToStr = Stream.ReadText
try = BytesToStr
Stream.Close
Set Stream = Nothing
End Function
Function stripNonNumeric(inputString)
Set regEx = New RegExp
regEx.Global = True
regEx.Pattern = "\D"
stripNonNumeric = regEx.Replace(inputString,"")
End Function
%>
On that "GetReply.asp" im getting a response of "200 ok" Can anyone tell me what am i missing or lacking with those code. I will really appreciate it. Thank you so much in advance.
As I said in my comment, I'm not sure why you go through all the pain of an ADO Stream. As far as I can tell from your code, all you need to do is something like this:
Then use the FileSystemObject as you currently do to write these values to file.
But if you get these values from a third-party, I would expect at least the "text" parameter to be URLencoded...