aznkidben2 has asked for the wisdom of the Perl Monks concerning the following question:

Sorry, I forgot to add the line breaks on the other Q.

Is it possible (using Perl) to redirect a website that has the words: "word1" (and/or)

"word2" (and/or) "word3" (and/or) "word4" (and/or) "word5" (and/or) "word6" (and/or)

"word7" (and/or) "word8" (and/or) "word9" (and/or) "word10" ---- to the webpage:
"D:\something\something\here.htm"?
::Can I make this program 'load up' when the computer (XP Pro) is starting, and keep the program "invisible" and run while the computer is kept on?::

How?

- Clearing it up -

My point is can i redirect a website by using Perl if there are any of the "words" on the page to D:\something\something\here.htm? Can I make the program startup with the computer and keep running while the computer is on? If so, how?

Best regards, Ben

edited: Tue Aug 12 00:58:03 2003 by jeffa - title change (was: "Perl (kinda long... but urgent!!)")

  • Comment on Redirect on detecting certain words on a page

Replies are listed 'Best First'.
Re: Redirect on detecting certain words on a page
by sauoq (Abbot) on Aug 12, 2003 at 00:24 UTC

    Not easily and not with any guarantees. You couldn't control the browser unless the browser gave you hooks to do it. If you are trying to restrict access to certain sites with undesirable content for your userbase, your best bet would probably be a firewall and a proxy server implementing PICS.

    What are you trying to do?

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: Redirect on detecting certain words on a page
by NetWallah (Canon) on Aug 12, 2003 at 02:54 UTC
    Sounds like what you need is the Proxomitron.

    This gets pretty close to the functionality you wanted - except for the "redirect" part. It CAN replace words, or prevent access to sites with specified content. It may even be able to do the redirect with a custom filter.

    Best of all, it's free. Recommended for general use anyway, to prevent popups, nasty ads, and verious parasitic behaviour patterns.

      Or Privoxy.

      Makeshifts last the longest.

Re: Redirect on detecting certain words on a page
by JamesNC (Chaplain) on Aug 12, 2003 at 02:32 UTC
    You would have to capture packets if it contains the stuff you are looking for, you could use Win32::OLE to manipulate the browser ... it might be easier to just build something to monitor the browsers history file and log it... or pop up a message box with something neat on it like "Perl knows what you did last summer..." If you can afford the PiX, that would do it, and some Switches and Routers have some limited capabilities... I think there are some personal firewalls that do what you want too, but I don't know that they would do exactly what you want. You can google for "personal firewalls"

    JamesNC
Re: Redirect on detecting certain words on a page
by TomDLux (Vicar) on Aug 12, 2003 at 02:29 UTC

    So you're trying to hijack a web page.

    You want your program to prevent the user from going to any web pages with certain contents, and re-directing them a fixed file on their computer.

    Will the user know you are interfering with their ability to browse? Will the owners of the pages know you are hijacking their viewers? If you're trying to censor a computer, why not just go buy some of the crappy software for the purpose? None of it works correctly, but it's likely to work better than a one-off you knock together.

    --
    TTTATCGGTCGTTATATAGATGTTTGCA