7

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);
codaddict
  • 445,704
  • 82
  • 492
  • 529
dandemeyere
  • 341
  • 1
  • 4
  • 14

1 Answers1

13

You can make use of LWP:

use LWP::Simple;
$contents = get $URL or die;
print $contents;
codaddict
  • 445,704
  • 82
  • 492
  • 529
  • obviously you don't need to store the contents. `use LWP::Simple; print get "http://google.com" or die;` and the `die` is a failsafe-exit – vol7ron Aug 07 '10 at 21:08
  • of course you could also just use `getprint()` : `use LWP::Simple; getprint("http://www.google.com") or die;` – vol7ron Aug 07 '10 at 21:11