Curlopt url in new tab
You want to open a URL in a new tab using the curl
command with the CURLOPT_URL
option.
By default, curl
will open the URL in the same tab or window. To open it in a new tab, you can use the -o
option followed by the path to a temporary file, and then use the xdg-open
command to open the file in a new tab.
Here's an example:
curl -o /dev/null -w "%{url_effective}\n" -L -o temp.html "https://example.com"
xdg-open temp.html
This will download the content of the URL to a temporary file named temp.html
, and then open it in a new tab using the xdg-open
command.
Alternatively, you can use the --new-tab
option with the xdg-open
command:
curl -o /dev/null -w "%{url_effective}\n" -L "https://example.com" | xdg-open --new-tab -
This will open the URL in a new tab directly, without creating a temporary file.
Note that the xdg-open
command is not available on all systems, so you may need to use a different command to open the URL in a new tab. For example, on macOS, you can use the open
command:
curl -o /dev/null -w "%{url_effective}\n" -L "https://example.com" | open -n -