如何编写Perl脚本以使用curl处理URL? [英] How do I write a Perl script to use curl to process a URL?

查看:264
本文介绍了如何编写Perl脚本以使用curl处理URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的任务。我有一个crontab,它将每小时运行一次脚本。该脚本仅用于处理URL。



这就是我所拥有的。没用我收到语法错误。

 #!/ usr / bin / perl 
curl http://domain.com /page.html;

我已经多年没有在Perl工作了,那时我也不怎么熟练。

解决方案



感谢Alex为我指出了正确的路径!



crontab

  * / 30 * * * * curl http:// domain .com / path.html 


解决方案

您可以使用 curl 通过反引号

  my $ curl =`curl http:// weverever `

或者您可以使用 WWW :: Curl


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

解决方案

You can either use curl via backticks

my $curl=`curl http://whatever`

or you can use WWW::Curl.

这篇关于如何编写Perl脚本以使用curl处理URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆