problem with redirect in CGI

Discussion in 'Perl Misc' started by Danny, May 1, 2004.

  1. Danny

    Danny Guest

    WE are using the redirect command in the code below, I am trying to test.
    we are trying to post our products on the shopping sites, like shopping.com,
    froogle, nextag etc etc.
    But when we use this url as you see below as the product_url, it gives an
    error. But if you copy and paste it into the url it will work. ODD. So I
    tried to do a redirect from my cgi directory and use this cgi script as the
    product url for these sites. But it does not work.
    How can I some how make it go to my website and act as if the product_url is
    being called from my website

    PS. the url works in some sites like froogle.
    the error comes from our product.cgi saying "cannot create session"
    I know the problem in there, but how can we make this work?

    here is code that does not work.
    (works for static html of course)
    #!/usr/bin/perl

    $theurl1 =
    "http://www.domain.com/product.cgi?productid=455&department=23333";
    use CGI;
    use CGI::Carp qw(fatalsToBrowser); # to display warnings and errors on the
    browser

    $co = new CGI;


    print $co->redirect(-url => $theurl1); # redirect to my page
     
    Danny, May 1, 2004
    #1
    1. Advertising

  2. > #!/usr/bin/perl
    >
    > $theurl1 =
    > "http://www.domain.com/product.cgi?productid=455&department=23333";
    > use CGI;
    > use CGI::Carp qw(fatalsToBrowser); # to display warnings and errors on the
    > browser
    >
    > $co = new CGI;
    >
    >
    > print $co->redirect(-url => $theurl1); # redirect to my page
    >



    Posting code like that could get you into serious trouble here, but I'll say
    no more.

    try:

    print $co-> redirect($theurl1);
     
    Julia deSilva, May 1, 2004
    #2
    1. Advertising

  3. Danny

    Danny Guest

    "Julia deSilva" <> wrote in message
    news:1CPkc.5800$...
    > > #!/usr/bin/perl
    > >
    > > $theurl1 =
    > > "http://www.domain.com/product.cgi?productid=455&department=23333";
    > > use CGI;
    > > use CGI::Carp qw(fatalsToBrowser); # to display warnings and errors on

    the
    > > browser
    > >
    > > $co = new CGI;
    > >
    > >
    > > print $co->redirect(-url => $theurl1); # redirect to my page
    > >

    >
    >
    > Posting code like that could get you into serious trouble here, but I'll

    say
    > no more.
    >
    > try:
    >
    > print $co-> redirect($theurl1);
    >
    >


    Thakns for helping.
    This did not work.
    Can I do one redirect that goes to a static html page on my server and then
    do another redirect from same cgi script that goes to this URL?

    Thanks again
     
    Danny, May 1, 2004
    #3
  4. Danny

    Danny Guest

    "Purl Gurl" <> wrote in message
    news:...
    > Danny wrote:
    >
    > (snipped)
    >
    > > But when we use this url as you see below as the product_url, it gives

    an
    > > error. But if you copy and paste it into the url it will work.

    >
    >
    > Dump CGI.pm completely.
    >
    > #!perl
    >
    > print "Location:

    http://www.domain.com/product.cgi?productid=455&department=23333\n\n";
    >
    > exit;
    >
    >
    > Purl Gurl


    I tried that too and it did not work
    But this worked - see code below.
    Is there a way to do tihs using the cgi redirect command from original post?
    Like make a header, then do the redirect? That would be a lot clenaer.
    Generating an actual generic web page then doing the html redirect works.

    Thanks for your help
    Here is the code


    print $co->header,
    '
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <META HTTP-EQUIV=REFRESH
    CONTENT="1;URL=http://www.myserver.com?blahblahblah">
    </head>
    </html>
    '
    ;
     
    Danny, May 1, 2004
    #4
  5. Danny

    Guest

    "Danny" <> wrote:
    > WE are using the redirect command in the code below, I am trying to test.
    > we are trying to post our products on the shopping sites, like
    > shopping.com, froogle, nextag etc etc.


    I don't understand the connection. You want to post a URL to someone
    else's site, which when followed goes to one of your sites, then redirects
    to a different one of your sites?


    > But when we use this url as you see below as the product_url, it gives an
    > error. But if you copy and paste it into the url it will work. ODD. So
    > I tried to do a redirect from my cgi directory and use this cgi script as
    > the product url for these sites.


    What do you mean "use this cgi script as the product url"? I can only
    assume "this" cgi is the one you posted below, and that obviously is not
    the product cgi.

    > But it does not work.
    > How can I some how make it go to my website and act as if the product_url
    > is being called from my website


    That doesn't make much sense. You build a vault, and then complain that
    other people can't get into it?

    > PS. the url works in some sites like froogle.
    > the error comes from our product.cgi saying "cannot create session"
    > I know the problem in there, but how can we make this work?


    If the problem is in product.cgi, then why don't you show us product.cgi?

    <snip code that apparently *does* work.>

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , May 1, 2004
    #5
  6. Danny

    Danny Guest

    <> wrote in message
    news:20040501163917.318$...
    > "Danny" <> wrote:
    > > WE are using the redirect command in the code below, I am trying to

    test.
    > > we are trying to post our products on the shopping sites, like
    > > shopping.com, froogle, nextag etc etc.

    >
    > I don't understand the connection. You want to post a URL to someone
    > else's site, which when followed goes to one of your sites, then redirects
    > to a different one of your sites?
    >
    >
    > > But when we use this url as you see below as the product_url, it gives

    an
    > > error. But if you copy and paste it into the url it will work. ODD.

    So
    > > I tried to do a redirect from my cgi directory and use this cgi script

    as
    > > the product url for these sites.

    >
    > What do you mean "use this cgi script as the product url"? I can only
    > assume "this" cgi is the one you posted below, and that obviously is not
    > the product cgi.
    >
    > > But it does not work.
    > > How can I some how make it go to my website and act as if the

    product_url
    > > is being called from my website

    >
    > That doesn't make much sense. You build a vault, and then complain that
    > other people can't get into it?
    >
    > > PS. the url works in some sites like froogle.
    > > the error comes from our product.cgi saying "cannot create session"
    > > I know the problem in there, but how can we make this work?

    >
    > If the problem is in product.cgi, then why don't you show us product.cgi?
    >
    > <snip code that apparently *does* work.>
    >
    > Xho
    >
    > --
    > -------------------- http://NewsReader.Com/ --------------------
    > Usenet Newsgroup Service $9.95/Month 30GB


    Thanks for your response.
    you know how you can submit a datafeed to froogle, shopping.com, nextag etc
    and they will list all of your products?
    that is what I am trying to do. Their requrements are name, description,
    price, thumbnail url and of course - product url.

    My product pages are dynamic in that the product pages are genereated from a
    cgi script which we do not have access to, it is a primitive shopping cart.
    So I got it to work for froogle, but others cause an error when the landing
    page is met. "cannot create session" which is generated from my shopping
    cart cgi. For some reason, it does not like the redirect from these
    shopping sites and I have no idea why. (the cart tech support is
    terrible!!).

    Since I could not send to a static page anywhere on the site, I figured cgi
    would help me and it has.
    I call the cgi script on my page, it spits out a basic page with just a
    header and with the <META HTTP-EQUIV=REFRESH CONTENT command to redirect to
    this url that has a call to the cgi script. This works because I assume the
    page is being viewed on my webserver and the call to the url is coming from
    my site.
    The cgi redirect command does not work, and the command from Purl Guru
    (print location from thread above) did not work. I am assuming because this
    does such a quick redirect.

    I am no perl expert, but I think I understand.

    Do I make sense?

    Thanks for your help
     
    Danny, May 2, 2004
    #6
  7. Danny

    Guest

    "Danny" <> wrote:
    >
    > My product pages are dynamic in that the product pages are genereated
    > from a cgi script which we do not have access to, it is a primitive
    > shopping cart. So I got it to work for froogle, but others cause an error
    > when the landing page is met. "cannot create session" which is generated
    > from my shopping cart cgi. For some reason, it does not like the
    > redirect from these shopping sites and I have no idea why. (the cart
    > tech support is terrible!!).


    I'll say!


    > Since I could not send to a static page anywhere on the site, I figured
    > cgi would help me and it has.
    > I call the cgi script on my page, it spits out a basic page with just a
    > header and with the <META HTTP-EQUIV=REFRESH CONTENT command to redirect
    > to this url that has a call to the cgi script. This works because I
    > assume the page is being viewed on my webserver and the call to the url
    > is coming from my site.


    I don't think that that is quite correct. The request is not coming from
    your server (assuming the end user is not on your server, that is), the
    request is coming from the end user's computer either way. That is, either
    $q->redirect or META tag causes a client-side redirect--not a server-side
    redirect. The difference (that I can see) is that the $q->redirect method
    causes the newly redirected request to report the original page (froogle,
    etc) as the http_referer, while the META method does not report any
    http_referer at all. I would guess your crappy shopping cart is, either
    intentionally or accidentally, blocking access based on http_referer.


    > The cgi redirect command does not work, and the command from Purl Guru
    > (print location from thread above) did not work. I am assuming because
    > this does such a quick redirect.


    The redirect command does work, it is the shopping cart program that
    doesn't work. It is true that you can work around the shopping cart bugs
    by using META tag rather than redirect, but that does not mean the redirect
    isn't working.


    > I am no perl expert, but I think I understand.
    >
    > Do I make sense?


    Yes.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , May 3, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,331
    Srowe1975
    Oct 15, 2008
  2. Sal
    Replies:
    1
    Views:
    917
  3. Ron Howard
    Replies:
    2
    Views:
    560
    Ron Howard
    Aug 11, 2004
  4. Luigi Ma
    Replies:
    0
    Views:
    163
    Luigi Ma
    Nov 21, 2007
  5. BestFriend
    Replies:
    2
    Views:
    892
Loading...

Share This Page