Languages
[Edit]
EN

Bash - get page source with cURL connection by IP address when we know domain name

9 points
Created by:
troya
572

In this short article, we would like to show how to get page source using cURL connection by IP address when we know the domain name under Bash.

Run the following command in the command line:

curl -k -H "Host: my-domain.com" https://192.168.0.70

or:

curl -H "Host: my-domain.com" http://192.168.0.70

Where:

  • -k lets to get a connection accepting untrusted or self-signed certificates,
  • my-domain.com should be set according to the assigned domain on the run server,
  • 192.168.0.70 should be changed to IP address that lets to access the server.

Example output:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Site title here ...</title>
  <meta name="keywords" content="keyword-1, keyword-2, keyword-3">
  <meta name="description" content="Some description here ...">
  <!-- ... -->
</head>
<body>
  <!-- ... -->
</body>
</html>

 

The above command should get the same effect like:

curl -k https://my-domain.com

or:

curl http://my-domain.com

Alternative titles

  1. Bash - get page source with cURL accepting untrusted certificate
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

â€ïžđŸ’» 🙂

Join