Send XML with PHP POST

Joined
Apr 30, 2009
Messages
1
Reaction score
0
Hi guys !
I need to post an XML file to an https server using POST method in PHP.
I have the code in ASP and I need to do the same in PHP.
Do you know some method to do this ?

ASP CODE :

HTML:
strRequest = ""
strResponse = ""
serverUrl = "myURL"
set mrequest = Server.CreateObject("Microsoft.XMLHTTP")
set xmlin = Server.CreateObject("MSXML2.DOMDocument")
msgpath = "/SHPesIN_PT.xml"
XMLFile = Server.MapPath(msgpath)
' Eventuale validazione
xmlin.validateOnParse = False
'Get XML Document from file
xmlin.Load XMLFile
strRequest = xmlin.Text
If xmlin.parseError.errorCode <> 0 Then
strResponse = _
"INVIO ANNULLATO!" & Chr(10) & Chr(13) & _
"Si verificato un errore di validazione del file xml a " & _
"livello del nodo" & xmlin.parseError.srcText
Else
mrequest.Open "POST", serverUrl, False
mrequest.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
mrequest.send "xmlin=" & xmlin.xml
If mrequest.Status = 200 Then
'Successful
strResponse = mrequest.responseText
Else
'Failure
strResponse = "Problemi con la ricezione della risposta dal server!"
End If
End If
Set xmlin = Nothing
Set mrequest = Nothing

Any suggestion is greatly appreciated !
Thx
- Kiko -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

XML HTTP POST Messaging 1
ASP / XML issue with IIS 2

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top