Page 1 of 1

Sending a file to server with httprequest

Posted: Tue Nov 09, 2021 4:32 pm
by loulou2522
How can I send an xml file generated on the client to the server? When I use httprequest, I get an error message

Code: Select all

Procedure HttpGetEvent1(Success, Result$, UserData)
  If Success
    debug result$
    Debug "Successful connection for PDF file calculation".
  Else
    debug result$
    Debug "Error: No Connection" + "Line 3995
  EndIf
 
  
EndProcedure
NewMap Headers$()
  Headers$("Access-Control-Allow-Origin") = "*"
  Headers$("HeaderContentType") = "application/xml"
   Headers$("Accept") = "application/xml"
  


  Global url.s="https://xxxx/xx.xml"
HTTPRequest(#PB_HTTP_Post,url,"",@HttpGetEvent1(),0,Headers$())
Thanks

Re: Sending a file to server with httprequest

Posted: Tue Nov 09, 2021 5:14 pm
by plouf
your script and target server should be in the same xxxx.xx domain
for test in house, you can use CORS plugin in your broweser, but thats only for test ...

discussions
viewtopic.php?f=6&t=2041&p=7715&hilit=cors
viewtopic.php?f=6&t=2186&p=8235#p8235