Solved

Will LWP retrieve graphics?

Posted on 2000-04-16
4
175 Views
Last Modified: 2010-03-05
I have a script to retrieve text from a web page. Can I get graphics also?

Thanks!!

Betsy
0
Comment
Question by:garfld
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 2721452
use LWP::Simple;
print status_message(getstore('http://www.experts-exchange.com/images/eelogoleft.gif','eelogoleft.gif'));
0
 
LVL 2

Author Comment

by:garfld
ID: 2721548
Sorry, i wasn't able to generalize from your answer. I'll increase points to 100. Here are my scripts, which gets data from the top story on CNN. First a quick html form script, then the perl:

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Quotes</title>
</head>
<body background=bkgrnd_tile.gif bgcolor=white leftmargin="50" topmargin="50" marginwidth="50" marginheight="50">
<p>
<div align="center"><h1>get gif!</h1></div>
<div align="center">
<form method="POST" action="http://localhost/cgi-bin/getgif.pl">
<input type="submit" value="  get gif  ">
</form>
</div>
</body>
</html>


use LWP::Simple;
use Text::Wrap;

#print status_message(getstory('http://www.experts-exchange.com/images/eelogoleft.gif','eelogoleft.gif'));

#$news = get ('http://www.cnn.com', 'http://www.cnn.com/2000/US/04/16/dc.protests.02/top.police.force.ap.jpg');

$news = get ("http://www.cnn.com");
$news =~ s/^.*<H3><A href=//s ;  
$news =~ s/FULL STORY.*$//s;
$news =~ s/<[^>]+>//g;
$news =~ s/^.*>//s;

print wrap('', '', $news );


Thanks!!
0
 
LVL 84

Expert Comment

by:ozo
ID: 2722178
If that's supposed to be a CGI program, you probably want to print CGI headers.
0
 
LVL 2

Author Comment

by:garfld
ID: 2723986
Here's the points, Ozo. I found the gif on my directory while I was looking for something else. So I "got" the gif but I didn't see it on a web page.

I'll give you 100 points for fixing my script, the one shown above, so that the web page comes back with text and graphics.

I tried adding a cgi object but must not have done it right.

Thanks!!

Betsy
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question