Solved

Will LWP retrieve graphics?

Posted on 2000-04-16
4
174 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…

730 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