Guest
2008-05-02T00:14:17Z
Hi there,

I see you have a PHP example for processing and incoming http form post which is great. Do you happen to have an ASP example I could get down and dirty with? I'm afraid to say I'm not quite sure about the structure of the posted data and how I would handle it with ASP. I need to save the image, subject and any text content from the original MMS message.

Many thanks in advance,

Nick
Support
2008-05-02T07:40:24Z
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

%>
Guest
2008-05-02T09:34:59Z
Hey, thanks very much. Its works just fine and now I understand! Thanks again.
Guest
2010-03-25T13:17:22Z
Using the above example how can you write the objHTTP.ResponseText into a DIV in the <BODY> on the page?
I can only get it to display outside of the <BODY> at the moment?
Thanks.
Users browsing this topic