简体   繁体   English

Perl相当于PHP的get_file_contents()?

[英]Perl equivalent of PHP's get_file_contents()?

The following PHP code does exactly what I want to do. 以下PHP代码完全符合我的要求。 The problem is I need to re-create it in Perl and I've been playing around with the open() and sysopen() Perl functions but can't do it. 问题是我需要在Perl中重新创建它,并且我一直在使用open()sysopen() Perl函数,但不能这样做。 Does anyone have any help or know of any links that might help? 有没有人有任何帮助或知道任何可能有帮助的链接? Thanks. 谢谢。

$URL = "http://example.com/api.php?arguments=values";
echo file_get_contents($URL);

You can make use of LWP : 你可以使用LWP

use LWP::Simple;
$contents = get $URL or die;
print $contents;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM