How to get the contents of a webpage in a shell variable?

后端 未结 6 1432
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 08:13

In Linux how can I fetch an URL and get its contents in a variable in shell script?

6条回答
  •  Happy的楠姐
    2020-12-07 08:41

    If you have LWP installed, it provides a binary simply named "GET".

    $ GET http://example.com
    
    
    
      
      Example Web Page
     
      
    

    You have reached this web page by typing "example.com", "example.net","example.org" or "example.edu" into your web browser.

    These domain names are reserved for use in documentation and are not available for registration. See RFC 2606, Section 3.

    wget -O-, curl, and lynx -source behave similarly.

提交回复
热议问题