Advertisement

05.07.2008 at 11:55AM PDT, ID: 23383893 | Points: 250
[x]
Attachment Details

Using LWP::Simple

Tags: Perl
What do I need to set up in order to get this url to be accessed?

My result is this:
Couldn't get it! at C:\Perl\myscripts\html processing\url_ex_5.pl line 4.
1:
2:
3:
4:
5:
6:
use LWP::Simple;
my $uri = 'http://www.perl.com/CPAN/';
$content = get($uri);
die "Couldn't get it!" unless defined $content;
 
print "Got content:\n$content\n";
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: lqwest
Question Asked On: 05.07.2008
Participating Experts: 3
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.07.2008 at 12:06PM PDT, ID: 21519390

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 12:12PM PDT, ID: 21519441

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 12:49PM PDT, ID: 21519756

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:22AM PDT, ID: 21534377

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:39AM PDT, ID: 21534536

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:51AM PDT, ID: 21534640

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 01:55PM PDT, ID: 21536350

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.10.2008 at 07:47AM PDT, ID: 21539212

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 02:16PM PDT, ID: 21550592

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 04:01PM PDT, ID: 21560019

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.19.2008 at 07:31AM PDT, ID: 21598095

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.07.2008 at 12:06PM PDT, ID: 21519390

Rank: Genius

what do you see with
print status_message(getprint($url));

 
05.07.2008 at 12:12PM PDT, ID: 21519441

Rank: Genius

Are you behind a firewall?  Can you get to that url from a web browser?
 
05.07.2008 at 12:49PM PDT, ID: 21519756
No problem getting to the url from the web browser.

If I put in the code snippet below I get this on console:

C:\Perl\myscripts\html processing>perl url_ex_5.pl
500 Can't connect to www.perl.com:80 (Bad hostname 'www.perl.com')
Couldn't get it! at url_ex_5.pl line 5.
Internal Server Error
C:\Perl\myscripts\html processing>
1:
2:
3:
4:
5:
6:
7:
use LWP::Simple;
my $uri = 'http://www.perl.com/CPAN/';
$content = get($uri);
print status_message(getprint($uri));
die "Couldn't get it!" unless defined $content;
 
print "Got content:\n$content\n";
Open in New Window
 
05.09.2008 at 09:22AM PDT, ID: 21534377
I added a shebang line and everything came through ok on my system.

Make sure perl is in your path, and do a perl -V and make sure that the perl libs are in the @inc path

@INC:
c:/Perl/lib
c:/Perl/site/lib

if they are not you may need to add
use lib 'c:/perl/lib', 'c:/perl/site/lib';
above your use LWP::Simple;
 
05.09.2008 at 09:39AM PDT, ID: 21534536
I did perl -V and at the end out the output there was this ( so all looks fine as far as libraries go):
  @INC:
    C:/Perl/lib
    C:/Perl/site/lib
 
05.09.2008 at 09:51AM PDT, ID: 21534640

Rank: Genius

From a command prompt, try:
    ping www.perl.com

What output do you get?
 
05.09.2008 at 01:55PM PDT, ID: 21536350
ping www.perl.com generates this message on my screen:

C:\Windows\system32>ping www.perl.com
Ping request could not find host www.perl.com. Please check the name and try again.
 
05.10.2008 at 07:47AM PDT, ID: 21539212
The code works fine on my home pc. There must be some sort of firewall issue, although I do have a firewall at home also.
 
05.12.2008 at 02:16PM PDT, ID: 21550592
It could also be a proxy server issue.  Since you cannot ping from the command line, no DNS resolution is taking place.   Try to ping 208.201.239.37 (one of the cpan mirrors IP addresses).  
 
05.13.2008 at 04:01PM PDT, ID: 21560019
When I type: ping 208.201.239.37, I get this output ( from command line)

Pinging 208.201.239.37 with 32 bytes of data:
Reply from 157.56.184.1: Destination host unreachable.
Request timed out.
Request timed out.
Reply from 157.56.184.1: Destination host unreachable.
Ping statistics for 208.201.239.37:
    Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),
 
05.19.2008 at 07:31AM PDT, ID: 21598095

Rank: Genius

I'm guessing you have a firewall blocking the traffic, with IE setup to use a proxy.
In Internet Explorer, select the menu Internet Options
Then select the tab Connections
Then click the button Lan Settings
Is the use a proxy server option turned on?
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628