In Linux how can I fetch an URL and get its contents in a variable in shell script?
In Linux how can I fetch an URL and get its contents in a variable in shell script?
No curl, no wget, no ncat, nothing? Use telnet:
$ content=$(telnet localhost 80)
GET / HTTP/1.1
Host: localhost
Connection: close
Connection closed by foreign host.
$ echo $content
HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 12:45:02 GMT Server:
Apache/2.4.46 (Fedora) OpenSSL/1.1.1j Last-Modified: Mon, 31 Dec 2018
15:56:45 GMT ETag: "a4-57e5375ad21bd" Accept-Ranges: bytes
Content-Length: 164 Connection: close Content-Type: text/html;
charset=UTF-8 Success! 192.168.1.1