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

Okay, So I have a Script that when it runs in increments a text file by one. this only happens when I go to the specific url where the script is, Is it possible to run this script from the website without having to actually goto the page its on? need this for a flash application I'm making I want it so the user clicks a link and it dynamically updates stuff within flash, it is working fine, except the page popping up which activiates the script, Thanks for any help you might have! SillyMonk
  • Comment on Executing a perl script thats on located on a website

Replies are listed 'Best First'.
Re: Executing a perl script thats on located on a website
by moritz (Cardinal) on Jan 29, 2008 at 21:18 UTC
    There are some ways to achieve that.

    The easiest, but certainly a "hack":

    <!-- HTML images: --> <img src="http://example.com/counter.cgi" width="1" height="1" />

    Or you can use a XMLHttpRequest to trigger the CGI script.

    If you use flash anyway, you can flash do the work for you, requesting an URL without updating the browser window.

    As a side node, this looks like a XY Problem to me, like you are trying to count visitors or hits on your page. There are far better approaches to do that, for example parsing the server log files. Or installing a custom log handler.

      "If you use flash anyway, you can flash do the work for you, requesting an URL without updating the browser window" Do you know what function I need to use in flash to achieve this? I'm not working on this strictly for a hit count on my website, will be used in a various number of ways. Thanks for your response moritz, lots of interesting information there!

        Wow. Really? A hit counter?

        1996 called, they want their useless web geegaw back.

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

        A reply falls below the community's threshold of quality. You may see it by logging in.