By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,348 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,348 IT Pros & Developers. It's quick & easy.

PHP script to RECEIVE XML documents?

P: 1
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.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....
May 3 '07 #1
Share this Question
Share on Google+
1 Reply


code green
Expert 100+
P: 1,726
If the file exists and is accesible, then you can open, read, write to the file using PHP file functions from a sript running on a scheduled task.
May 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.