in reply to Passing params to a php file via perl cgi script.

I'll bet what's happening is that your cgi script is being called with the following parameters:

As a result, when you attempt to call your get() subroutine with the value of the 'url' parameter, you are only passing 'http://www.asite.com/result.php'.

To avoid this, you should replace the non-alpha (e.g., ? and &) characters in your url to their encoded equivalents:

Which would mean calling your cgi script with the following as a 'url' parameter:

http://www.mysite.com/cgi-bin/my_perl.cgi?url=http%3A%2F%2Fwww.asite.com%2Fresult.php%3Fmode%3Dn%26color%3Dblue%26age%3D18

dmm

If you GIVE a man a fish you feed him for a day
But,
TEACH him to fish and you feed him for a lifetime

Replies are listed 'Best First'.
(jeffa) 2Re: Passing params to a php file via perl cgi script.
by jeffa (Bishop) on Jan 20, 2002 at 03:49 UTC
    "etc. (look up the rest)"

    I couldn't resist:

    my %codes = map {chr($_) => sprintf("%%%x",$_)} (0..255); print map {"$_ => " . $codes{$_} . "\n"} qw(& / : = ?);
    But, URI::Escape is much better.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

      URI::Escape is the way to go if you're comfortable using modules ...

      dmm

      If you GIVE a man a fish you feed him for a day
      But,
      TEACH him to fish and you feed him for a lifetime