EN
Bash - get page source with cURL connection by IP address when we know domain name
9 points
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:
xxxxxxxxxx
1
curl -k -H "Host: my-domain.com" https://192.168.0.70
or:
xxxxxxxxxx
1
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:
xxxxxxxxxx
1
% Total % Received % Xferd Average Speed Time Time Time Current
2
Dload Upload Total Spent Left Speed
3
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
4
5
<!DOCTYPE html>
6
<html lang="en">
7
<head>
8
<title>Site title here ...</title>
9
<meta name="keywords" content="keyword-1, keyword-2, keyword-3">
10
<meta name="description" content="Some description here ...">
11
<!-- ... -->
12
</head>
13
<body>
14
<!-- ... -->
15
</body>
16
</html>
The above command should get the same effect like:
xxxxxxxxxx
1
curl -k https://my-domain.com
or:
xxxxxxxxxx
1
curl http://my-domain.com