Forum Moderators: coopster

Message Too Old, No Replies

PHP Redirect Script

         

triumph

10:12 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



I'm trying to modify a php redirect script I have to do a double redirect (I think that's right term)

when passing the following URL:

www.mysite.com?redirect.php?m=ama&url=http://www.affiateexample.com/product_sku/12312

I need it to go to www.affiliatesite.com main page and drop my referral cookie, then redirect again to the actual destination page. This my attempt at deep linking affiliate links that don't support deep linking.

An example would be great!

Thanks in advance,

Triumph

Clinton Labombard

10:25 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



I've noticed if you don't end a script after a header() call the script will still attempt to run... maybe a double header()?

header('location: first site to drop the cookie');
header('location: second site to send the visitor');
die(); # and end the script right here

eeek

1:17 am on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Two Location: headers? Is that even legal?

triumph

1:36 am on Feb 10, 2006 (gmt 0)

10+ Year Member



I tried two headers, and it looks like it skips the first header call, and just goes right to the next header location.

Any other ideas?

Dijkgraaf

2:13 am on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The affeliate page is the one that has to do the second redirect. So unless they offer that funcionality there is no way that I know of doing it.

jatar_k

7:13 am on Feb 10, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well maybe, man I have no idea if this will work but...

open a socket or use curl and hit the first page then send them to the deep page, you can dump the return page you get back, just use output buffering or something and clear the buffer then use header and send your visitor to the actual page.

this really might not work well and I can see there being a few, um, intricacies involved. You should test something like this on a site you control so you can look at logs and whether it tracks properly.

another thing might be if there is no link to this deep page from the main page then it could look suspect. You don't want to get booted out of any aff programs.

eeek

7:37 am on Feb 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I tried two headers, and it looks like it skips the first header call, and just goes right to the next header location.

Which of the headers that is actually used is undefined. In other words it depends on the browser and is subject to change.