?
Solved

Will LWP retrieve graphics?

Posted on 2000-04-16
4
Medium Priority
?
178 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
  • 2
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 150 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 85

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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
Suggested Courses

850 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