Citation :
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
' Description : compose la requète Http d'upload de fichier et l'envoie
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Private Function RequeteHTTP(strURL As String) As String
Dim strXML As String 'Contenu du XML
Dim strBody As String 'Contenu de la requète HTTP
Dim aPostData() As Byte
Dim ServerSafeHTTP As New XMLHTTP
'Préparation des entete et body du formulaire
ServerSafeHTTP.Open "POST", strURL, False
strBody = ""
strBody = strBody & fm_SetBody("txt_str_codeIntervention", strNumIntervention)
strBody = strBody & fm_SetBody("txt_str_DteGen", strDteGen)
strBody = strBody & fm_SetBody("txt_str_HreGen", strHreGen)
strBody = strBody & fm_SetBodyFile(Right(strXMLFilePath, 3), strFileName) 'entete du fichier selon son type
strBody = strBody & strXML & vbCrLf & "--" & Const_BOUNDARY & "--" 'Fin de traitement
aPostData = StrConv(strBody, vbFromUnicode)
ServerSafeHTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & Const_BOUNDARY & vbCrLf
ServerSafeHTTP.send aPostData
If ServerSafeHTTP.Status = 200 Then
RequeteHTTP = ServerSafeHTTP.responseText
Else
RequeteHTTP = "Erreur : " & ServerSafeHTTP.Status & vbCrLf & ServerSafeHTTP.StatusText & vbCrLf & ServerSafeHTTP.responseText
End If
End Function
|