简体   繁体   English

PHP或Javascript读取clickbank hoplink cookie?

[英]PHP or Javascript to read clickbank hoplink cookie?

I need to write a PHP or javascript that can read the clickbank cookie that's set when a user has clicked on one of my affiliate's hoplinks prior to reaching any of my sales pages. 我需要编写一个PHP或javascript,它可以读取用户访问我的任何销售页面之前单击我的会员的一个跳链接时设置的clickbank cookie。

How can one do this? 一个人怎么能做到呢?

Here's my example: 这是我的示例:

I have a main salespage that I direct my referred users to (users who already know me and were not referred by an affiliate). 我有一个主要的销售页面,可以将我的推荐用户定向到(已经知道我但未被关联公司推荐的用户)。 It does not use ClickBank as a payment gateway. 它不使用ClickBank作为支付网关。

I also have a salespage specifically for clickbank referrals. 我还有一个专门针对clickbank推介的销售页面。 It uses ClickBank to clear transactions. 它使用ClickBank清除交易。

I would like to add script to MY salespage that will check to see if the user has an active cookie that denotes they've been referred to my product page by a hoplink. 我想将脚本添加到“我的销售”页面,该脚本将检查用户是否具有活动cookie,该cookie表示他们已被Hoplink引用到我的产品页面。 If so, I want to redirect them to the clickbank sales page for my product. 如果是这样,我想将它们重定向到我的产品的clickbank销售页面。

Any help much appreciated. 任何帮助,不胜感激。

I know how the clickbank works and he tried to explain something different. 我知道clickbank的工作原理,他试图解释一些不同的东西。

When affiliates sending visitors to his sale page, it adds the affiliate id at the end (fx mysite.com/?id=nick) 当会员将访客发送到他的销售页面时,它会在结尾添加会员ID(fx mysite.com/?id=nick)

People can also come to his sale page directly(like mysite.com) simply typing his url. 人们也可以直接输入网址(例如mysite.com)直接进入他的销售页面。 So he wants to check if the visitor come directly or with an affilate link. 因此,他想检查访问者是直接访问还是带有亲属链接。

So you have to answer first : -Are you saving cookies at visitor browser(if not, you don't have to worry about your problem)? 因此,您必须首先回答:-您是否在访问者浏览器中保存cookie(如果没有,则不必担心问题)? -If not, then @Robert answer is going to help you... -如果没有,那么@Robert的答案将帮助您...

You can't read cookies for a domain that isn't yours. 您无法读取不是您自己的域的Cookie。 So if ClickBank sets cookies for clickbank.com then you can't access them from yourdomain.com . 因此,如果ClickBank为clickbank.com设置cookie,那么您将无法从yourdomain.com访问它们。

If you share part of a domain then you can. 如果您共享域的一部分,则可以。 Eg. 例如。 clickbank.example.com and yoursite.example.com the cookies could be set to example.com and be read by both. 可以将clickbank.example.com和yoursite.example.com的cookie设置为example.com,并且两者均可读取。 However clickbank would have to make this change so I think you're probably out of luck. 但是clickbank必须做出更改,因此我认为您可能不走运。

Or you could get the hop variable directly from the URL and redirect to your affiliate sales page. 或者,您可以直接从URL获取Hop变量,然后重定向到您的会员销售页面。

<?php
if(isset($_GET['hop'])) {
    $cbid = htmlentities($_GET['hop']);
    header('location: affiliatesalespage.php?a='.$cbid);
}
?>

@Balir McMillan summed it up pretty well, cookies are locked to the domain that set it, that includes sub domains etc. @Balir McMillan很好地总结了它,cookie被锁定到设置它的域,包括子域等。

I am not fully shore how ClickBank works but it seems to me that you want to check to make sure that the referral was from a clickbank hop. 我还没有完全了解ClickBank的工作原理,但是在我看来,您想检查一下以确保引荐来自clickbank啤酒花。

What you can do in PHP is check the $_SERVER['HTTP_REFERER'] to check the referrer, but I will tell you this can be faked and should be used with caution 在PHP中可以执行的操作是检查$_SERVER['HTTP_REFERER']来检查引荐来源网址,但我会告诉您,这是伪造的,应谨慎使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM