Another way to do this is to send a GET request to the destination page within your script and write the lines to output as you get them. Something like this would work:

use LWP::Simple; $destURL = "http://www.yahoo.com"; $doc = get "$destURL"; print "Content-Type: text\html\n\n"; print $doc;

Basically, it will send the current HTML for $destURL to the browser as if it were yours. It will show up under your domain and URL.

NOTE: This could be used for some questionable behavior. You're basically taking someone's copyrighted material, copying it, and showing it to someone else as if it were yours. It's an interesting thing to do, but if you don't make it clear to the user that this isn't your page, it's dishonest and possibly illegal. To the extent that either of these things bothers you, please be careful with this technique.

The downside here is that your script will be hanging in the wind until it gets the response back from $destURL. If you have lots of instances running at the same time, this could create a large memory footprint. Putting a timeout in the script could help, as could running it under mod_perl so only one Perl interpreter gets forked. Then again, if you only need this once in a while, you could probably run it as-is.

Hope this helps.


In reply to Re: Redirected URL will not be displayed in the browser by gazpacho
in thread Redirected URL will not be displayed in the browser by Anonymous Monk

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.