Jump to content

How to execute a http delete request by microsoft.xmlhttp


 Share

Recommended Posts


How to use winhttp or xmlhttp to send a delete request?

Here is the trying but failed:

1.
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("delete", $Url, False)

2.
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("delete", $Url, False)

3.
$oHTTP = ObjCreate("MSXML2.XMLHTTP")
$oHTTP.Open("delete", $Url, False)

All example above can't be used to execute delete request.

It seems that all those methods don't contain a delete method.
 

Link to comment
Share on other sites

Hi Chamlien,

Have you tried to use the WinHTTP UDF ?
Take a look at the _WinHttpOpenRequest function, it has a parameter where you can specify the method (in your case "DELETE").

Br, FireFox.

Hi FireFox,

I found that WinHTTP have DELETE Method, but I need to set many request headers, so How to set more than three request headers like this:

     $oHTTP.setRequestHeader("Accept", "*, */*")
     $oHTTP.setRequestHeader("Accept-Encoding", "identity")
     $oHTTP.setRequestHeader("Content-Type", "text/xml")
     $oHTTP.setRequestHeader("Connection", "keep-alive")

Thanks for answering very much.

Link to comment
Share on other sites

Hi FireFox,

I found that WinHTTP have DELETE Method, but I need to set many request headers, so How to set more than three request headers like this:

     $oHTTP.setRequestHeader("Accept", "*, */*")
     $oHTTP.setRequestHeader("Accept-Encoding", "identity")
     $oHTTP.setRequestHeader("Content-Type", "text/xml")
     $oHTTP.setRequestHeader("Connection", "keep-alive")

Thanks for answering very much.

I don't know, just use the WinHTTP UDF, it's made for that ; to make things simple and not having to interact with the object.

Br, FireFox.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...