problem with redirect in CGI

D

Danny

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
 
D

Danny

Julia deSilva said:
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
 
D

Danny

Purl Gurl said:
Danny wrote:

(snipped)



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>
'
;
 
C

ctcgag

Danny said:
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
 
D

Danny

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?



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.


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


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

<snip code that apparently *does* work.>

Xho

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
 
C

ctcgag

Danny said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top