Passing data to perl script from Web page

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Passing data to perl script from Web page

    Hey peoples, perhaps you could help me with this tricky code I'm hoping to
    build. I have developed a small emailing program for my business. At the
    bottom of the emails that get sent out, there is an option for a recipient
    to remove themselves from my mailing list.

    Here is what I am looking to do. At the bottom of the email, the removal
    link would contain something like this:

    To remove yourself from my mailing list, click here:
    [url]http://www.mysite.com/cgi-bin/remove.pl?user=theemail@address.com[/url]

    I am looking to have my perl script read the referring link and detect the
    user= tag ... them perform the necessary function to splice that email from
    my database ... Can Perl do this? Below is an example of the theoretical
    code. Note: the second line is not valid perl code obviously, simply my
    goal:

    #!/usr/bin/perl

    $theuser = HTTP{REFFERAL_TAG, 'user'}; #scan the reffering html URL for the
    "user" variable

    open (ADDRESSES, "<data/addressbook.txt") or !die ("Unable to open");
    @recipients=<ADDRESSES>;
    close(ADDRESSES);

    foreach $recipients(@recipients) {
    $count++;
    if ($recipients =~ /$theuser/i) {
    $count--;
    splice(@recipients, $count, 1);
    }

    print "Location: $confpage\n\n"; #redirects to a confirmation page

    Please let me know if this can be done, and/or if it cannot be done and you
    have an alternate idea. Code examples are welcomed. Thanx everyone!

    Randy


    \Dandy\ Randy Guest

  2. Similar Questions and Discussions

    1. Passing values from web page to php script
      Hi Everyone, First excuse my language and the way I explain things. I try to be clear enough. I do have a simple system that processes...
    2. Passing parameters to a Perl Script from Command Line (Linux)
      Hi, I'm fairly new to both programming in shell script (linux) and in programming in perl. I need to pass a parameter to the perl script from...
    3. passing data from one page to another
      I have a .aspx page (we'll call it Form1) with a datagrid on it. The datagrid is populated from a dataset that I manually entered data into (the...
    4. Passing value from one script on one page to another script on another page.
      Hi All, I have what is an easy question for you all, but I have not idea (this is in vbscript). I have this script below that works great. It...
    5. Passing large ammount of data to php script
      Ok, I know you can pass data in the querystring (getURL('http://localhost/output.php?text=hello');), but as far as I can remember there is a limit...
  3. #2

    Default Re: Passing data to perl script from Web page

    Randy wrote:

    (snipped)
    > Here is what I am looking to do. At the bottom of the email, the removal
    > link would contain something like this:
    > To remove yourself from my mailing list, click here:
    > [url]http://www.mysite.com/cgi-bin/remove.pl?user=theemail@address.com[/url]

    You have included an environment query string.
    Why not use it? Dump your "user=" as this only
    adds unwarranted complexity.


    Purl Gurl
    --

    #!perl

    $ENV{'QUERY_STRING'} = 'sissified_geek@purlgurl.net';

    while (<DATA>)
    {
    if ($_ eq "$ENV{'QUERY_STRING'}\n")
    { next; }
    else
    { push (@Array, $_); }
    }

    print @Array;

    print "Location: http://www.purlgurl.net\n\n";


    __DATA__
    [email]purlgurl@purlgurl.net[/email]
    [email]godzilla@purlgurl.net[/email]
    [email]sissified_geek@purlgurl.net[/email]
    [email]callgirl@purlgurl.net[/email]


    PRINTED RESULTS:
    ________________

    [email]purlgurl@purlgurl.net[/email]
    [email]godzilla@purlgurl.net[/email]
    [email]callgirl@purlgurl.net[/email]
    Location: [url]http://www.purlgurl.net[/url]
    Purl Gurl Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139