How to get picture file in web which involve redirection using LWP 
Author Message
 How to get picture file in web which involve redirection using LWP

I tried to get some images from the web using LWP, and find out some
sites won't allow me to do it directly with absolute URL address (eg.
http://www.*-*-*.com/ ). Even from the browser, if I type
the absolute URL address, it will redirect me to other page insted
retrieve the image. So I need to go to their main page (eg.
http://www.*-*-*.com/ ) and click its link within the page to
retrieve the image. I think there are some sort of file protection in
the site which force the user to navigate through their pages to get
those files.

So if I do the following code in Perl:

---------------------
use LWP::Simple;

if (is_success($rtrcode =
getstore(" http://www.*-*-*.com/ ;, "pic.jpg"))) {
  print "Got file.\n";            

Quote:
} else {

  print "Can not find file\n";
Quote:
}

print "rtrcode is: $rtrcode\n";
----------------------

the return code still '200' but i am not getting the right file.
(instead, it is a redirected index file).

Any idea on how to solve this problem?

Thanks,
Antonio.



Thu, 10 Nov 2005 19:23:18 GMT  
 How to get picture file in web which involve redirection using LWP


Quote:
> I tried to get some images from the web using LWP, and find out some
> sites won't allow me to do it directly with absolute URL address (eg.
> http://www.hostname.com/dir/pic.jpg). Even from the browser, if I type
> the absolute URL address, it will redirect me to other page insted
> retrieve the image. So I need to go to their main page (eg.
> http://www.hostname.com) and click its link within the page to
> retrieve the image. I think there are some sort of file protection in
> the site which force the user to navigate through their pages to get
> those files.

> So if I do the following code in Perl:

> ---------------------
> use LWP::Simple;

> if (is_success($rtrcode =
> getstore("http://www.hostname.com/dir/pic.jpg", "pic.jpg"))) {
>   print "Got file.\n";            
> } else {
>   print "Can not find file\n";
> }
> print "rtrcode is: $rtrcode\n";
> ----------------------

> the return code still '200' but i am not getting the right file.
> (instead, it is a redirected index file).

> Any idea on how to solve this problem?

> Thanks,
> Antonio.

sounds like they don't want you to get the images... why not honor their
intentions?

--
Michael Budash



Fri, 11 Nov 2005 08:21:22 GMT  
 How to get picture file in web which involve redirection using LWP

Quote:
>I tried to get some images from the web using LWP, and find out some
>sites won't allow me to do it directly with absolute URL address (eg.
>http://www.hostname.com/dir/pic.jpg). Even from the browser, if I type
>the absolute URL address, it will redirect me to other page insted
>retrieve the image. So I need to go to their main page (eg.
>http://www.hostname.com) and click its link within the page to
>retrieve the image. I think there are some sort of file protection in
>the site which force the user to navigate through their pages to get
>those files.

>So if I do the following code in Perl:

>---------------------
>use LWP::Simple;

>if (is_success($rtrcode =
>getstore("http://www.hostname.com/dir/pic.jpg", "pic.jpg"))) {
>  print "Got file.\n";            
>} else {
>  print "Can not find file\n";
>}
>print "rtrcode is: $rtrcode\n";
>----------------------

>the return code still '200' but i am not getting the right file.
>(instead, it is a redirected index file).

>Any idea on how to solve this problem?

>Thanks,
>Antonio.

what's the domain? let me try.

 w i l l



Sat, 12 Nov 2005 03:21:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. downloading and extracting zip files from the Web using LWP and Compress::Zlib

2. getting URL when using LWP::

3. Getting "(Cannot determine protocol) when using lwp:simple

4. Using LWP: getting the code for a website?

5. web crawler using LWP with protected directories ?

6. Using LWP and looking exactly like a web browser

7. Getting a web page content using perl

8. LWP question - can't download pictures..

9. Getting the exact address of a file received through LWP

10. Use of LWP to extract a file from the web

11. How to print a binary string as picture to web page

12. dynamically resizing pictures for a web page

 

 
Powered by phpBB® Forum Software