473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Perl equiv to PHP file()

(Slightly OT.) Does anybody here who works in both PHP and Perl happen to
know whether there is a Perl equivalent to PHP's file(url)? I need to get
the HTML output of a file as served through HTTP into some form so that I
can write it locally (on the same host machine) as static HTML, and some
complicated facts about permissions on the machine I'm working on may make
it necessary to work through Perl for this part rather than PHP. I've
already posted to comp.lang.perl.misc, but it then occurred to me to post
here as well, just in case somebody here might know. Thanks!

(It's a long story, but some of it is that the PHP files stored on the same
host as HTML and Perl files are served by a distinct server. As things
stand now, a PHP that calls fopen() will give me an [onscreen] error because
of lack of permission. The administrator may or may not give me permission
to have a PHP script write an HTML file to the disk, or she may not know how
to allow permissions. She is also extremely busy and it may take her a long
time even to discuss it, and I need to get this thing running soon. This is
a Windows machine, BTW. The Perl scripts are served by the standard server,
and I'm pretty sure that Perl scripts are allowed to write files.)

Amittai Aviram

Jul 16 '05 #1
1 1621
On Mon, 18 Aug 2003 13:49:04 -0400 in
<message-id:bh************@ID-124651.news.uni-berlin.de>
"Amittai Aviram" <am*****@amittai.com> wrote:
(Slightly OT.) Does anybody here who works in both PHP and Perl
happen to know whether there is a Perl equivalent to PHP's file(url)?
I need to get
the HTML output of a file as served through HTTP into some form so
that I can write it locally (on the same host machine) as static
HTML, and some complicated facts about permissions on the machine I'm
working on may make it necessary to work through Perl for this part
rather than PHP. I've already posted to comp.lang.perl.misc, but it
then occurred to me to post here as well, just in case somebody here
might know. Thanks!

Look at the LWP::Simple module and LWP::UserAgent module. Does what
you're after. AFAIK, there's no "nice easy" function wrapper for it:
use LWP::UserAgent;

[ ... ]

my $user_agent = LWP::UserAgent->new;
my $url = $domain . $def_remote;
my $res = $user_agent->request(HTTP::Request->new(GET => $url),
This is a small snippet of some Perl code I used to retrieve Zip files
from my AV vendor. The $url can be a page rather than a file though =)
HTH.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John | last post by:
Dear all, It been more than 3 days I am trying to debug this program, I interpret it using activePerl and it is giving (perl -wc code_process.pl) no error syntax but when I put it online, change...
1
by: timdavis919 | last post by:
I'm trying to build some Russian web pages using Perl and MySQL. Toward that end, I have created a simple test case, which does not seem to work. Any help would be appreciated. I can...
1
by: newhaven_lad | last post by:
Please could someone help, I have a Perl cgi script which works perfectly when run in a dos prompt, it connects to a database on my laptop and inserts a record. But when I use the internet browser...
1
by: andipfaff | last post by:
Hi there, I am fighting with my MysQL database in order to get french and cyrillic characters properly displayed on my website. I've created tables with latin1 charset. My Perl script on the...
0
by: perlwml | last post by:
If I use plain WML (ie, not generated by perl, but written out as WML in a file) then I can create cards that are displayed properly on my cell phone (motorola i415). But if I use Perl to generate...
22
by: owlice | last post by:
Greetings! I thought I'd add a little something to a web site, a "tip of the week," and wanted it automated so that if I get hit by a truck (or, more likely, am forgetful), the tip is updated...
3
by: bpejman | last post by:
I have a Perl-driven website on a windows 2003 server. I have configured the IIS and have set the permissions on the Home Directory tab to Read, Write and my Execute Permissions are set to "Scripts...
66
by: happyse27 | last post by:
Hi All, my html code is sno 1) and perl code is sno 2). a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
3
by: happyse27 | last post by:
Hi All, I am creating the perl script using html form(with embedded javascript inside). When using this html form with javascript alone, it works where the form validation will pop up...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.