ygcho_jason has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: redirection problem
by neilwatson (Priest) on Feb 22, 2006 at 18:00 UTC | |
|
Re: redirection problem
by Anonymous Monk on Feb 23, 2006 at 12:09 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |