Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > hope this is easy, passing a url as a parameter

Reply
Thread Tools

hope this is easy, passing a url as a parameter

 
 
Danny
Guest
Posts: n/a
 
      05-01-2004
I am trying to pass a parameter to a cgi script, it is a URL that has its
own call to a cgi script with ? in statement.
for example

so my cgi (load.cgi) is getting confused because of the extra ? in the
statement.
my cgi redirects to the passed url

I call it like this:
http://www.domain.com/cgi-bin/load.c...om/cgi-bin/pro
ducts.cgi?search=volvo

what do I do to get that entire url, right now it is stopping at the other ?

Thanks in advance


 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      05-01-2004
Danny wrote:
> I am trying to pass a parameter to a cgi script, it is a URL that has its
> own call to a cgi script with ? in statement.
> for example
>
> so my cgi (load.cgi) is getting confused because of the extra ? in the
> statement.
> my cgi redirects to the passed url
>
> I call it like this:
> http://www.domain.com/cgi-bin/load.c...om/cgi-bin/pro
> ducts.cgi?search=volvo


Encode the URL, this is wrong.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
 
Reply With Quote
 
 
 
 
Danny
Guest
Posts: n/a
 
      05-01-2004

"John Bokma" <> wrote in message
news:40931fc8$0$198$...
> Danny wrote:
> > I am trying to pass a parameter to a cgi script, it is a URL that has

its
> > own call to a cgi script with ? in statement.
> > for example
> >
> > so my cgi (load.cgi) is getting confused because of the extra ? in the
> > statement.
> > my cgi redirects to the passed url
> >
> > I call it like this:
> >

http://www.domain.com/cgi-bin/load.c...om/cgi-bin/pro
> > ducts.cgi?search=volvo

>
> Encode the URL, this is wrong.
>
> --
> John MexIT: http://johnbokma.com/mexit/
> personal page: http://johnbokma.com/
> Experienced Perl programmer available: http://castleamber.com/


Thanks

How can I encode the URL.?



 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      05-01-2004
Danny wrote:

>
> "John Bokma" <> wrote in message
> news:40931fc8$0$198$...
>> Danny wrote:
>> > I am trying to pass a parameter to a cgi script, it is a URL that has

> its
>> > own call to a cgi script with ? in statement.
>> > for example
>> >
>> > so my cgi (load.cgi) is getting confused because of the extra ? in the
>> > statement.
>> > my cgi redirects to the passed url
>> >
>> > I call it like this:
>> >

> http://www.domain.com/cgi-bin/load.c...in.com/cgi-bin

pro
>> > ducts.cgi?search=volvo

>>
>> Encode the URL, this is wrong.
>>
>> --
>> John MexIT: http://johnbokma.com/mexit/
>> personal page: http://johnbokma.com/
>> Experienced Perl programmer available: http://castleamber.com/

>
> Thanks
>
> How can I encode the URL.?


Its a faq.

http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html
How do I decode or create those %-encodings on the web?


But its better to use the cgi.pm module

gtoomey
 
Reply With Quote
 
Danny
Guest
Posts: n/a
 
      05-01-2004

"Gregory Toomey" <> wrote in message
news:1513682.d3x1Bjo0rK@GMT-hosting-and-pickle-farming...
> Danny wrote:
>
> >
> > "John Bokma" <> wrote in message
> > news:40931fc8$0$198$...
> >> Danny wrote:
> >> > I am trying to pass a parameter to a cgi script, it is a URL that

has
> > its
> >> > own call to a cgi script with ? in statement.
> >> > for example
> >> >
> >> > so my cgi (load.cgi) is getting confused because of the extra ? in

the
> >> > statement.
> >> > my cgi redirects to the passed url
> >> >
> >> > I call it like this:
> >> >

> > http://www.domain.com/cgi-bin/load.c...in.com/cgi-bin

> pro
> >> > ducts.cgi?search=volvo
> >>
> >> Encode the URL, this is wrong.
> >>
> >> --
> >> John MexIT: http://johnbokma.com/mexit/
> >> personal page: http://johnbokma.com/
> >> Experienced Perl programmer available: http://castleamber.com/

> >
> > Thanks
> >
> > How can I encode the URL.?

>
> Its a faq.
>
> http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html
> How do I decode or create those %-encodings on the web?
>
>
> But its better to use the cgi.pm module
>
> gtoomey


Thanks

I will fix this:

but an initial call with this long url is always made from my index.html,
how can I encode a URL in an HTML page?

Thanks again


 
Reply With Quote
 
gnari
Guest
Posts: n/a
 
      05-01-2004
"Danny" <> wrote in message
newsLKkc.67740$. net...
>
> "Gregory Toomey" <> wrote in message
> news:1513682.d3x1Bjo0rK@GMT-hosting-and-pickle-farming...
> > Danny wrote:
> >
> >
> > Its a faq.
> >
> > http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html
> > How do I decode or create those %-encodings on the web?
> >
> >
> > But its better to use the cgi.pm module
> >

>
> Thanks
>
> but an initial call with this long url is always made from my index.html,
> how can I encode a URL in an HTML page?


thats where the FAQ code can be handy.
just make a short script that encodes our urls, and
paste them into your html.
or have your whole html file generated by this script.
or just use a oneliner:
perl -ple '$_="text to encode";s/([^\w()\'*~!.-])/sprintf "%%%02x", ord
$1/eg'

gnari




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to function not expecting parameter Mister B C Programming 8 08-26-2010 08:01 AM
Parameter List / Parameter Block / Anything patterns... mast2as@yahoo.com C++ 4 03-29-2007 09:37 PM
Passing a URL as a parameter does not appear to work Email.IainWilson@gmail.com Javascript 1 10-09-2005 05:16 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM



Advertisments