Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 532 Vote(s) - 3.45 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to capture cURL output to a file?

#1
I have a text document that contains a bunch of URLs in this format:

URL = "sitehere.com"

What I'm looking to do is to run `curl -K myfile.txt`, and get the output of the response cURL returns, into a file.

How can I do this?
Reply

#2
For a single file you can use `-O` instead of `-o filename` to use the last segment of the URL path as the filename. Example:

curl

[To see links please register here]

-O

will save the results to a new file named **big-file.iso** in the current folder. In this way it works similar to [wget][1] but allows you to specify other [curl options][2] that are not available when using wget.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
There are several options to make curl output to a file

# saves it to myfile.txt
curl

[To see links please register here]

-o myfile.txt

# The #1 will get substituted with the url, so the filename contains the url
curl

[To see links please register here]

-o "file_#1.txt"

# saves to data.txt, the filename extracted from the URL
curl

[To see links please register here]

-O

# saves to filename determined by the Content-Disposition header sent by the server.
curl

[To see links please register here]

-O -J
Reply

#4
curl -K myconfig.txt -o output.txt

Writes the *first* output received in the file you specify (overwrites if an old one exists).

curl -K myconfig.txt >> output.txt
Appends all output you receive to the specified file.

**Note: The -K is optional.**
Reply

#5
Use `--trace-ascii output.txt` to output the curl details to the file `output.txt`.
Reply

#6
A tad bit late, but I think the OP was looking for something like:
```
curl -K myfile.txt --trace-ascii output.txt
```
Reply

#7
You need to add quotation marks between "URL" -o "file_output" otherwise, curl doesn't recognize the URL or the text file name.

**Format**

curl "url" -o filename

**Example**

curl "https://en.wikipedia.org/wiki/Quotation_mark" -o output_file.txt

**Example_2**

curl "https://en.wikipedia.org/wiki/Quotation_mark" > output_file.txt

**Just make sure to add quotation marks.**
Reply

#8
Writes the first output received in the file you specify (overwrites if an old one exists).

curl -K myconfig.txt >> output.txt

Reply

#9
For those of you want to copy the cURL output in the clipboard instead of outputting to a file, you can use `pbcopy` by using the pipe `|` after the cURL command.

Example: `curl https://www.google.com/robots.txt | pbcopy`. This will copy all the content from the given URL to your clipboard.

Linux version: `curl https://www.google.com/robots.txt | xclip`

Windows version: `curl https://www.google.com/robots.txt | clip`
Reply

#10
If you want to store your output into your desktop, follow the below command using post command in git bash.It worked for me.

```
curl

[To see links please register here]

--request POST
--header "Content-Type: application/json"
-o "C:\Desktop\test.json"
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through