Please find ASP code below for retrieving an MMS message and storing it on the local drive:
<%
Username = "MyUsername"
Password = "MyPassword"
From = Request("from")
MMSSubject= Request("text")
MessageId = Request("msgid")
FileList = Request("filelist")
'NOTES:
'You must create a folder called C:\MMSFiles
'You must also make sure that PHP scripts have permission to write to this folder
GetMMSFiles Username, Password, MessageId, FileList, "C:\MMSFiles\"
Function GetMMSFiles ( Username, Password, MessageId, FileList, DestinationPath )
Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
FileListArray = Split(FileList,",")
For Each MMSFilename in FileListArray
GetMMSFile objHTTP, Username, Password, MessageId, MMSFilename, DestinationPath & MMSFilename
Next
Set objHTTP = nothing
End Function
Function GetMMSFile ( objHTTP, Username, Password, MessageId, MMSFile, DestinationFilename )
Url = "http://www.intellisoftware.co.uk/smsgateway/retrievemms.aspx" & _
"?username=" & Server.UrlEncode(Username) & _
"&password=" & Server.UrlEncode(Password) & _
"&msgid=" & Server.UrlEncode(MessageId) & _
"&msgpart=" & Server.UrlEncode(MMSFile)
objHTTP.Open "GET", Url, False
objHTTP.Send
If objHTTP.Status = 200 Then
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
set objStream = createobject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.Write objHTTP.ResponseBody
objStream.SaveToFile DestinationFilename, adSaveCreateOverWrite
objStream.Close
set objStream = nothing
'Check for error from the IntelliSoftware platform
ContentType = objHTTP.getResponseHeader("content-type")
If Left(ContentType,5) = "text/" Then
If Left(objHTTP.ResponseText,4) = "ERR:" Then
If Len(objHTTP.ResponseText) < 100 Then
Response.Write objHTTP.ResponseText & " (" & "MMSFilename:" & MMSFile & ")<BR>"
End If
End If
End If
Else
Response.Write "HTTP Fetch Error:" & objHTTP.Status & "<BR>"
End If
End Function
%>