Hello

I am trying to write cgi scripts that extracts parts of certain web page with regex, and display that on the browser.

Here is the script I wrote

#!/usr/bin/perl use LWP::UserAgent; print "Content-type: text/html\n\n"; $user_agent = new LWP::UserAgent; $user_agent->timeout(10); $request = new HTTP::Request('GET' , 'http://www.ypbooks.co.kr/ypbooks +/WebHome/dqsearch/isbn.jsp?isbn=8957590528'); $response = $user_agent->request($request); print $response->content; # end of script

here I want to get web page "http://www.ypbooks.co.kr/ypbooks/WebHome/dqsearch/isbn.jsp?isbn=8957590528"

but this address is immediately redirected to different address  "http://www.ypbooks.co.kr/ypbooks/WebHome/specdm/specdm.jsp?p_isbn=2210100105"

but I can not extract the part of the first address page with Regular Expression This redirection is not under control of my cgi script. If this redirection is controlled by my scripts, I could extract part of the redirected web page, but I can't and the second, redirected address page is displayed having its own address on the browser. How can I extract the part of redirected web page only knowing the first address and not knowing the second, redirected address?

Edit: g0n - added formatting


In reply to redirection problem by ygcho_jason

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.