I am wondering what the best way is to have my Apache/PHP server accept an XML file that is sent at random using an ASP Send function. My client is using ASP (POST and SEND) to send a 0.5 to 2MB XML string, which I must immediately accept and save to disk.
I have built the web pages to do this with normal user (html) interaction (ie: click to add a file, and upload by clicking submit), but I am stumped on how to do this through an automated means. I must be missing something really simple. Any thoughts? Cheers!
'----- MY CLIENT'S ASP CODE THAT WILL SEND XML TO OUR PHP SERVER... -----
' *** Set up a command to send an XML file to a remove server ***
' *** - Includes MP3 file Base64 encoded
RawDir=Server.MapPath("/UserContent/" & NMD("CampaignID")) & "\Voice\"
RS.Open "SELECT * FROM UserContent WHERE ContentID=" & ContentID ,
objApp.DB,adOpenStatic,adLockOptimistic,adCmdText
' *** Create XML object ***
Set objXMLDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
objXMLDoc.loadXML "<InstallVoice />"
Set oRoot = objXMLDoc.documentElement
' *** Set up a bunch of elements here ..
/ 8< snip 8<
' *** Read the file into the stream ***
Set oRoot = objXMLDoc.documentElement
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile RawDir & RS("UploadFile")
' *** Do base64 encoding for an MP3 file ***
Set oElement = objXMLDoc.createElement("FileContents")
oElement.dataType = "bin.base64"
oElement.nodeTypedValue = objStream.Read
oRoot.appendChild oElement
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", "http//myhostsomewhere.com/uploader.php", false
' *** Send the file up ***
xmlhttp.send objXMLDoc.XML
' *** Close down the effort....