CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Libwww-perl and socket on portland and netfirms

 



wisgroups
Novice

Sep 11, 2002, 9:47 AM

Post #1 of 9 (3521 views)
Libwww-perl and socket on portland and netfirms Can't Post

Hello,

I need to use lwp or socket in my perl script but everytime I try to use

them on portland.co.uk and netfirms.com they don't work. I really need to

know why lwp and socket doesn't work on portland.co.uk and netfirms.com.



Thank You


ksnm
New User

Sep 11, 2002, 11:33 AM

Post #2 of 9 (3518 views)
Re: [wisgroups] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

LWP worked perfectly for me for both of your sites. Here is my Code:

#!/usr/bin/perl

use LWP::Simple;
$url = "
http://www.portland.co.uk";
$context = get($url);


print "Content-type: text/html \n\n";
print "<html>\n";


print "<head>\n";

print "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" > \n\n";
print "<title>Get REMOTE site to your site</title>\n";


print "</head>\n";

print "<body vlink=black link=black>";

print "$context\n";

print "</body>\n";

print "</html>\n";

-Sharad Gadadare


davorg
Thaumaturge / Moderator

Sep 11, 2002, 11:33 AM

Post #3 of 9 (3517 views)
Re: [wisgroups] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

What do you mean by "don't work" what errors are you getting?


Code
$ perl -MLWP::Simple -le 'getprint "http://portland.co.uk"' 
500 Can't connect to portland.co.uk:80 (Bad hostname 'portland.co.uk') <URL:http://portland.co.uk>

$ perl -MLWP::Simple -le 'getprint "http://www.portland.co.uk"'
<!-- Escapade for Linux - version BETA-0.2.1 - 08-11-01 @ 19:15 (build 1152) -->
<!-- This software is Copyright 2000, Squished Mosquito, Inc. http://www.escapade.org -->
<!-- Escapade LICENSED version -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Portland Communications</TITLE>

[more html snipped]

$ perl -MLWP::Simple -le 'getprint "http://netfirms.com"'
<!-- Escapade for Linux - version BETA-0.2.1 - 08-11-01 @ 19:15 (build 1152) -->
<!-- This software is Copyright 2000, Squished Mosquito, Inc. http://www.escapade.org -->
<!-- Escapade LICENSED version -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

[more html snipped]


They seem to work ok to me.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


wisgroups
Novice

Sep 11, 2002, 1:29 PM

Post #4 of 9 (3512 views)
Re: [davorg] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

I mean that I use Portland.co.uk and Netfirms.com for hosting of my cgi scripts.

But LWP doesn't work at portland and netfirms web hosting when I use LWP in my site.

Are there any alternative of LWP for getting content from remote sites ?


davorg
Thaumaturge / Moderator

Sep 11, 2002, 10:25 PM

Post #5 of 9 (3510 views)
Re: [wisgroups] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

LWP isn't a standard part of Perl. You need to install it separately. You should contact the sysafmins at those sites and ask them to install LWP.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


wisgroups
Novice

Sep 12, 2002, 3:08 AM

Post #6 of 9 (3504 views)
Re: [davorg] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

I know that and I have installed it to my cgi-bin directory. And after that I

always receive timeout(80) error when I try to fetch. Even if I try to get yahoo.com

I get a timeout(80) error.

How can I solve that problem ?


davorg
Thaumaturge / Moderator

Sep 12, 2002, 3:20 AM

Post #7 of 9 (3503 views)
Re: [wisgroups] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

What do you mean by "I have installed it to my cgi-bin directory"?

Did you follow the proper installation instructions? You many need to ask a sysadmin to install it for you.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


thebitch
User

Sep 12, 2002, 6:47 AM

Post #8 of 9 (3500 views)
Re: [davorg] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

basically, this is entirely an issue for your
sysadmin ~ you need to talk to him either way

who knows, maybe they have a firewall installed


ksnm
New User

Sep 12, 2002, 8:24 AM

Post #9 of 9 (3496 views)
Re: [thebitch] Libwww-perl and socket on portland and netfirms [In reply to] Can't Post

This is what I did, and it works perfect:

See if this helps you.

My configuration is:
Solaris 8 with perl version 5.005_03 built for sun4-solaris. If you have a different machine, you may need to do it a bit different, but this should give you a good idea anyway.

I needed to install LWP, but needed to match these
pre-requisites also.

Will need C compiler CC from sun to compile the code in the required libraries.

1. Download the cc from SUN site. It is 60 day free trial.
Should buy if need to continue.
The software is available at:
http://wwws.sun.com/software/sundev/suncc/buy/index.html
Software is:
Sun ONE Studio 7, Compiler Collection


2. Downloaded these modules from CPAN web site
http://www.perl.com/CPAN/modules/01modules.index.html

Modules are:
MIME-Base64-2.12.tar.gz
URI-1.22.tar.gz
HTML-Parser-3.26.tar.gz
libnet-1.12.tar.gz
Digest-MD5-2.20.tar.gz

3. Installed them in the same sequence as listed above. Read the instructions for installation. This is where you will use the CC to compile these codes.

4. Downloaded LWP from:
http://www.linpro.no/lwp/

5. Installed LWP as per instructions.

That's it. You are ready to use LWP and have fun.

This is a test script which shows all of www.cnn.com
#
# cat test.pl
#!/usr/bin/perl

use LWP;
print "This is libwww-perl-$LWP::VERSION\n";

use LWP::Simple;
$url = "http://www.cnn.com";
$context = get($url);

print "$context\n";
#
#

__________________
Sharad Gadadare

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives