问题
I have a very simple task. I have a crontab that will run a script every hour. The script is meant to simply process a URL.
This is what I have. It doesn't work. I get a syntax error.
#!/usr/bin/perl
curl http://domain.com/page.html;
I haven't worked in Perl in years and wasn't very adept when I did.
SOLUTION
Thanks, Alex for pointing me to the correct path!
crontab
*/30 * * * * curl http://domain.com/path.html
回答1:
You can either use curl
via backticks
my $curl=`curl http://whatever`
or you can use WWW::Curl.
回答2:
To call any shell command from Perl, you can use system:
system "curl http://domain.com/page.html";
Just enclose the shell command in quotes.
来源:https://stackoverflow.com/questions/7196124/how-do-i-write-a-perl-script-to-use-curl-to-process-a-url