使用/usr/bin/links命令获取网页内容的方法,以下为示例脚本:
# cat /root/cron/ticket_visit.sh
#!/bin/bash
Dates=`date +%Y%m%d%H%M`
echo "$Dates" >> /tmp/ticket_visit.txt
/usr/bin/links -source 1 >>/tmp/ticket_visit.txt
附:
links命令参数详解:
Usage: elinks [OPTION]... [URL]...
Options:
-anonymous [0|1] Restrict to anonymous mode
-auto-submit [0|1] Autosubmit first form
-base-session Clone internal session with given ID
-config-dir Name of directory with configuration file
-config-dump Print default configuration file to stdout
-config-file Name of configuration file
-config-help Print help for configuration options
-default-mime-type MIME type assumed for unknown document types
-default-keys [0|1] Ignore user-defined keybindings
-dump [0|1] Print formatted versions of given URLs to stdout
-dump-charset Codepage to use with -dump
-dump-color-mode Color mode used with -dump
-dump-width Width of document formatted with -dump
-eval Evaluate configuration file directive
-force-html Interpret documents of unknown types as HTML
-?, -h, -help Print usage help and exit
-localhost [0|1] Only permit local connections
-long-help Print detailed usage help and exit
-lookup Look up specified host
-no-connect [0|1] Run as separate instance
-no-home [0|1] Disable use of files in ~/.elinks
-no-numbering Disable link numbering in dump output
-no-references Disable printing of link references in dump output
-remote Control an already running ELinks
-session-ring Connect to session ring with given ID
-source [0|1] Print the source of given URLs to stdout
-touch-files [0|1] Touch files in ~/.elinks when running with -no-connect/-session-ring
-verbose Verbose level
-version Print version information and exit
阅读(6399) | 评论(0) | 转发(0) |