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 :
Any suggestion is greatly appreciated !
Thx
- Kiko -
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 -