How to use a POST request in batch with curl.exe?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
hacxx
Posts: 47
Joined: 09 Apr 2015 13:18

How to use a POST request in batch with curl.exe?

#1 Post by hacxx » 22 Sep 2020 10:31

How to use a POST request in batch with curl.exe?

Download curl.exe
http://www.cyberlord.at/forum/?id=10589 ... =38&page=1

curl.exe (Oficial site)
https://curl.haxx.se/windows/

File of interest

Code: Select all

/bin/curl.exe
----------------------------------------------------
For GET requests
----------------------------------------------------

Code: Select all

curl.exe --get --insecure "http://website.com/search.php?url=http://secondsite.com"



----------------------------------------------------
For POST requests
----------------------------------------------------
???????????????????????

Squashman
Expert
Posts: 4206
Joined: 23 Dec 2011 13:59

Re: How to use a POST request in batch with curl.exe?

#2 Post by Squashman » 22 Sep 2020 10:36

Curl is part of Windows 10 already.

Code: Select all

C:\>where curl.exe
C:\Windows\System32\curl.exe

hacxx
Posts: 47
Joined: 09 Apr 2015 13:18

Re: How to use a POST request in batch with curl.exe?

#3 Post by hacxx » 22 Sep 2020 11:09

Squashman wrote:
22 Sep 2020 10:36
Curl is part of Windows 10 already.

Code: Select all

C:\>where curl.exe
C:\Windows\System32\curl.exe
ok, but how to make POST requests?

OJBakker
Expert
Posts: 39
Joined: 12 Aug 2011 13:57

Re: How to use a POST request in batch with curl.exe?

#4 Post by OJBakker » 22 Sep 2020 12:55

See the curl manual/tutorial at https://curl.haxx.se/docs/manual.html

hacxx
Posts: 47
Joined: 09 Apr 2015 13:18

Re: How to use a POST request in batch with curl.exe?

#5 Post by hacxx » 23 Sep 2020 07:12

OJBakker wrote:
22 Sep 2020 12:55
See the curl manual/tutorial at https://curl.haxx.se/docs/manual.html
I have read the docs and the method for POST request doesn't work.
I was looking for any tips on how to make it work.

ShadowThief
Expert
Posts: 993
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to use a POST request in batch with curl.exe?

#6 Post by ShadowThief » 23 Sep 2020 07:36

There are two methods listed there: -d and -F. I know for a fact that -F works because I use it on a regular basis to upload to imgur.

It's hard to troubleshoot your issue if you don't give us more details, like where you're trying to send the command or what the exact commands that you tried were.

hacxx
Posts: 47
Joined: 09 Apr 2015 13:18

Re: How to use a POST request in batch with curl.exe?

#7 Post by hacxx » 24 Sep 2020 06:10

ShadowThief wrote:
23 Sep 2020 07:36
There are two methods listed there: -d and -F. I know for a fact that -F works because I use it on a regular basis to upload to imgur.
Give me example of -F command.

I'm using the command below and the http server doesn't show any access attempt.

Code: Select all

curl -d "name=test&phone=00000000" http://127.0.0.1/index.php
If i use the get command to access localhost, it works.

Code: Select all

curl --get --insecure http://127.0.0.1/index.php

ShadowThief
Expert
Posts: 993
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to use a POST request in batch with curl.exe?

#8 Post by ShadowThief » 25 Sep 2020 20:04

hacxx wrote:
24 Sep 2020 06:10
ShadowThief wrote:
23 Sep 2020 07:36
There are two methods listed there: -d and -F. I know for a fact that -F works because I use it on a regular basis to upload to imgur.
Give me example of -F command.

I'm using the command below and the http server doesn't show any access attempt.

Code: Select all

curl -d "name=test&phone=00000000" http://127.0.0.1/index.php
If i use the get command to access localhost, it works.

Code: Select all

curl --get --insecure http://127.0.0.1/index.php
The -F equivalent of that would be

Code: Select all

curl -F "name=test" -F "phone=0000000" http://127.0.0.1/index.php

hacxx
Posts: 47
Joined: 09 Apr 2015 13:18

Re: How to use a POST request in batch with curl.exe?

#9 Post by hacxx » 03 Oct 2020 05:36

ShadowThief wrote:
25 Sep 2020 20:04
The -F equivalent of that would be

Code: Select all

curl -F "name=test" -F "phone=0000000" http://127.0.0.1/index.php
Doesn't work, the request never reach the http server.

Post Reply