/    Sign up×
Community /Pin to ProfileBookmark

How can I pass URL Parameters to a new URL in ‘meta refresh content’ ?

Hello,

Could anyone help me with next problem:

Visitors come to a website through a Clickbank affiliatelink
http: //nick.vendor.hop.clickbank.net
But they will land on different websites based on an URL parameter, for example
http: //nick.vendor.hop.clickbank.net?x=prod1 they’ll go to www.websiteA.com

http: //nick.vendor.hop.clickbank.net?x=prod2 they’ll go to www.websiteB.com

http: //nick.vendor.hop.clickbank.net?x=prod3 they’ll go to www.websiteC.com

remark : nick is also variable (it is the affiliates name), so links could be:
http: //NICK.vendor.hop.clickbank.net?x=PROD1 or prod2 etc…
or
http: //JOHN.vendor.hop.clickbank.net?x=PROD1 or prod2 etc…
or
http: //CHARLES.vendor.hop.clickbank.net?x=PROD1 or prod2 etc…

Clickbank is linking to a page (based on the Clickbank account configuration) including following parameters, where a script will redirect the visitor to the right website
http: //www.mylandingwebsite.com/linkpage.php?hop=nick&x=prod1
So there are 2 variable parameters (value of hop and value of x)!

The problem is that with the ‘meta refresh content’ the parameters are not passed to the new URL.
For example:
The link http: //nick.vendor.hop.clickbank.net?x=prod1 should lead to or result in
http: //www.websiteA.com?hop=nick (with a 60 days cookie so that the affiliate still gets his commission if the visitor decide to come back later and buy). Obviously I only need the hop=’value’ at the final website.

This is the code I have so far (it leads to the right website based on ‘x=’ but it doesn’t pass the ‘hop=’ value , nick or john or charles or whatsoever)
Linkpage.php

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Doorlinken</title>
</head>

<body>
<?php
if(isset($_GET[‘x’]))
{
if($_GET[‘x’] == “prod1″)
{
echo ‘<meta http-equiv=”refresh” content= “0;URL=http://www.websiteA.com” />’;
}
elseif($_GET[‘x’] == “prod2″)
{
echo ‘<meta http-equiv=”refresh” content= “0;URL=http://www.websiteB.com” />’;
}
elseif($_GET[‘x’] == “prod3″)
{
echo ‘<meta http-equiv=”refresh” content= “0;URL=http://wwwwebsiteC.com” />’;
}
}
else echo ‘<meta http-equiv=”refresh” content= “0;URL=http://www.website.com/products.php” />’;

?>
</body>
</html>
[/CODE]

So the result should be content= “0;URL=http://www.websiteA.com?hop=nick” or john or …
And do I need the head-section? Or just the script between < ?php and ? >

Thanks in advance for your help,

x

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@belperauthorJun 01.2011 — Hello,

I notice that I didn’t explain my problem clearly and simply enough.

So I will try to reformulate it.

Visitors come to a webpage through following URL

http: //www.mywebsite.com/linkpage.php?hop=affiliatename&x=productname

affiliatename is a variable parameter, so it can be anything

productname is also a variable parameter, and the value of it is used to redirect to another website;

Example:

If x=prod1 redirect to http: //www.websiteA.com

Or if x=prod2 redirect to http: //www.websiteB.com

Or if x=prod3 redirect to http: //www.websiteC.com

If none of these values redirect to http: //www.myotherwebsite.com

However the new URL should also contain the variable parameter hop=affiliatename

(from http: //www.mywebsite.com/linkpage.php?hop=affiliatename&x=productname)

So in case of

x=prod1 the new URL should be http: //www.websiteA.com?hop=affiliatename

x=prod2 the new URL should be http: //www.websiteB.com?hop=affiliatename

x=prod3 the new URL should be http: //www.websiteC.com?hop=affiliatename

or else http: //www.myotherwebsite.com?hop=affiliatename

and together with the new URL there should be set a 60 days cookie so that the affiliate still gets his commission if the visitor decide to come back later and buy.

Based on the parameter x=prod redirect to a new website is not a problem. It is working in my script (maybe a newbie script, but it is working. However a more simple and/or professional script would be welcome). The real problem is that the variable parameter hop=affiliatename should be passed in the new URL and to set a 60 days cookie.

I really hope I exposed my problem more clearly now.

Once again thanks in advance to everyone willing to help me.
Copy linkTweet thisAlerts:
@belperauthorJun 04.2011 — Here is a solution I found, used by other Clickbank vendors and that seems to do the job as needed for a Clickbank vendor.

Create a page (let us call it redirect.php)

[CODE]

<?php
$redirects = array(
“prod1&#8243; => “http://www.websiteA.com”,
“prod2&#8243; => “http://www. websiteB.com”,
“prod3&#8243; => “http://www. websiteC.com”
);
$x = $_GET["x"];
if (array_key_exists($x, $redirects)) {
$go = $redirects[$x];
header(“Location:$go”);
die();
}
?>
[/CODE]


In the landing page http: //www.website.com/products.php (this was the page in my example if x did not exist or if x=non valid value) add this code:

[CODE]<?php include(“redirect.php”); ?>[/CODE]

Remark: 1/ This line has to be at the very very start of that page, so it has to be the very first line of your code on that page. 2/ Your landing page has to be a PHP extension. If your page is “http: //www.website.com/products.html” is has to be changed in “http: //www.website.com/products.php”

I wish to thank all the people that helped me and provided ideas to solve this problem.
×

Success!

Help @belper spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...