I am wondering what the best way is to have my Apache/PHP server accept an XML file that is sent using an ASP Send function. My client is using ASP to send a .5 to 2MB XML string, which I must accept and save to disk.
I have built the webpages to do this with user 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!
'-------- ASP CODE THAT SENDS TO OUR PHP SERVER... --------
' *** Set up a command to send an XML file to a remove server ***
' *** - Includes MP3 file Base64 encoded
RawDir=Server.M apPath("/UserContent/" & NMD("CampaignID ")) & "\Voice\"
RS.Open "SELECT * FROM UserContent WHERE ContentID=" & ContentID ,
objApp.DB,adOpe nStatic,adLockO ptimistic,adCmd Text
' *** Create XML object ***
Set objXMLDoc = Server.CreateOb ject("Msxml2.DO MDocument.3.0")
objXMLDoc.loadX ML "<InstallVo ice />"
Set oRoot = objXMLDoc.docum entElement
' *** Set up a bunch of elements here ..
/ 8< snip 8<
' *** Read the file into the stream ***
Set oRoot = objXMLDoc.docum entElement
Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Type = 1
objStream.Open
objStream.LoadF romFile RawDir & RS("UploadFile" )
' *** Do base64 encoding for an MP3 file ***
Set oElement = objXMLDoc.creat eElement("FileC ontents")
oElement.dataTy pe = "bin.base64 "
oElement.nodeTy pedValue = objStream.Read
oRoot.appendChi ld oElement
Set xmlhttp = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
xmlhttp.open "POST", "http//myhostsomewhere .com/uploader.php", false
' *** Send the file up ***
xmlhttp.send objXMLDoc.XML
' *** Close down the effort....
I have built the webpages to do this with user 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!
'-------- ASP CODE THAT SENDS TO OUR PHP SERVER... --------
' *** Set up a command to send an XML file to a remove server ***
' *** - Includes MP3 file Base64 encoded
RawDir=Server.M apPath("/UserContent/" & NMD("CampaignID ")) & "\Voice\"
RS.Open "SELECT * FROM UserContent WHERE ContentID=" & ContentID ,
objApp.DB,adOpe nStatic,adLockO ptimistic,adCmd Text
' *** Create XML object ***
Set objXMLDoc = Server.CreateOb ject("Msxml2.DO MDocument.3.0")
objXMLDoc.loadX ML "<InstallVo ice />"
Set oRoot = objXMLDoc.docum entElement
' *** Set up a bunch of elements here ..
/ 8< snip 8<
' *** Read the file into the stream ***
Set oRoot = objXMLDoc.docum entElement
Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Type = 1
objStream.Open
objStream.LoadF romFile RawDir & RS("UploadFile" )
' *** Do base64 encoding for an MP3 file ***
Set oElement = objXMLDoc.creat eElement("FileC ontents")
oElement.dataTy pe = "bin.base64 "
oElement.nodeTy pedValue = objStream.Read
oRoot.appendChi ld oElement
Set xmlhttp = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
xmlhttp.open "POST", "http//myhostsomewhere .com/uploader.php", false
' *** Send the file up ***
xmlhttp.send objXMLDoc.XML
' *** Close down the effort....
Comment