Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl equivalent of PHP's get_file_contents()?

The following PHP code does exactly what I want to do. 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. 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);
like image 242
dandemeyere Avatar asked Aug 05 '10 08:08

dandemeyere


1 Answers

You can make use of LWP:

use LWP::Simple;
$contents = get $URL or die;
print $contents;
like image 86
codaddict Avatar answered Oct 04 '22 01:10

codaddict