Passing a subid to the merchant within a PHP redirect

Status
Not open for further replies.

ImagesAndWords

StayblCam.com
Nov 7, 2006
2,326
90
0
Scottsdale, Arizona
www.stayblcam.com
First of all - mods, if you think this should go in the Design&Development section feel free to move it.

I'm in the process of setting up a new site where I want full keyword-level tracking while using PHP redirects instead of direct affiliate links.
I take every incoming keyword and assign it a numeric id in a database.
I do this with this great script by our very own smaxor. :bowdown:

So for example, my landing page gets called like this:
Code:
    www.myfuglylandingpage.cum/index.php?keyword=n00bfodder
That keyword is assigned a number, like 723 and set in the php variable $id

Now the next thing I wanna do is take this number and pass it along to the merchant. BUT... I do not want to link directly to the merchant from the landing page like this
Code:
[FONT=&quot][URL="http://publishers.xy7.com/z/43422/CD3149/"]hxxp://publishers.xy7.com/z/43422/CD3149/[/URL][/FONT]
but rather use a PHP redirect.

So I created a PHP redirect file called redirect.php and I can call this from anywhere on my landing page and pass along the $id to it like this:
Code:
    www.myfuglylandingpage.cum/redirect.php?[COLOR=Lime][B]number[/B][/COLOR]=<? echo [COLOR=Yellow][B]$id[/B][/COLOR]; ?>
And this is what my redirect.php file looks like:
Code:
<?php
  [B][COLOR=Cyan]$subid[/COLOR][/B] = trim($_GET['[COLOR=Lime][B]number[/B][/COLOR]']);
  header( "Location: [FONT=&quot][URL="http://publishers.xy7.com/z/43422/CD3149/"]hxxp://publishers.xy7.com/z/43422/CD3149/[/URL][/FONT]".[COLOR=Cyan][B]$subid[/B][/COLOR]) ;
?>
So what's my problem?
Well, everything seems to work great, until the point where $subid is supposed to be passed along to the merchant. XY7 never gets my subid (I checked their detailed .csv subid stats file and had my aff. manager check this). They think I'm not passing the subid correctly in the aff. link URL.
I'm still fairly new to php so my guess is that I'm not handling the string or variables correctly somehow. Everything else works fine. Smaxor's script works, calling the redirect.php with a number works, and the redirect itself works.

Perhaps someone can point me in the right direction?

Danke!
Thank you!
Gracias!
Takk!
 


What you are trying to do is extremely easy...but it would be easier to provide accurate assistance if you just posted the entire script you are using, instead of incoherent bits and pieces.
 
What's happening is that you're not actually inserting the sub ID into the redirect properly. If I assume that the way to track sub IDs with DirectTrack/XY7 is hxxp://publishers.xy7.com/z/43422/CD3149/subid, the code should be

header( "Location: [FONT=&quot]hxxp://publishers.xy7.com/z/43422/CD3149/[/FONT]$subid") ;

The way my script is setup is...

Code:
<?php
  $subid = trim($_GET['qr']);
  header( "Location: http://www.test.com/$subid") ;
?>
Therefore, if my script is called as redirect.php?qr=test1, the site that is called is http://www.test.com/test1

Hope this helps.
 
  • Like
Reactions: ImagesAndWords
That is not any different than what he currently has, except that your code stuffs the PHP variable into the text (noob style coding) string rather than keeping it separated (correct style coding).

He also said that he is assigning numbers to keywords himself, yet he did not include the entire script so HOW he is doing that is still a mystery.
 
That is not any different than what he currently has, except that your code stuffs the PHP variable into the text (noob style coding) string rather than keeping it separated (correct style coding).

He also said that he is assigning numbers to keywords himself, yet he did not include the entire script so HOW he is doing that is still a mystery.
My bad... I should've tested his code first. I go by the theory that if code works (and doesn't open up a security hole), it's fine to use, but I guess that's not how programmers do things.

On a second look, the code you have should work. Tried it myself, and the /whatever was added when the script was called with ?number=whatever. If you're calling the script properly, I'd bank on the issue being with the advertiser not supporting Sub IDs for some reason.
 
johu and WeBcYtE; thanks for the quick responses..

That is not any different than what he currently has, except that your code stuffs the PHP variable into the text (noob style coding) string rather than keeping it separated (correct style coding).

He also said that he is assigning numbers to keywords himself, yet he did not include the entire script so HOW he is doing that is still a mystery.

Uhm...well I'm not sure how the rest of my code is relevant?
I posted all you should need to know and I know for a fact that:

1) the $id has in fact been assigned to a number with smax0r's script. I have tested this, and it works. So we know that the php variable $id does have a value and is not empty.

2) the $id is in fact being passed to the redirect.php when I do this call on the landing page:
Code:
 [URL="http://www.myfuglylandingpage.cum/redirect.php?"]www.myfuglylandingpage.cum/redirect.php?[/URL]number=<? echo [COLOR=Yellow][B]$id[/B][/COLOR]; ?>
How do I know this? Because when I hover the mouse over the link, it shows:
Code:
 [COLOR=Orange][U][URL="http://www.myfuglylandingpage.cum/redirect.php?"]www.myfuglylandingpage.cum/redirect.php?[/URL]number=723[/U][/COLOR]
So the problem must be within the redirect.php file.

WeBcYtE; could you please also elaborate on why johu's way of concatenating the string is less desirable than the way I did it?
 
Here's what you can do to check if the variable is actually being passed. In IE, paste in your redirect link script URL with the ?number=723 appended. If you're using IE7, click the "Page" button, and then click "web page privacy report". In IE6, I think you can access that from the view menu. That will give a break down of each step in the path.

Most likely, it will show that it passes it on the variable. If it does show that, you'll have to take it up with XY7, and see if they see any sub ids tracking among other affiliates for that merchant, or other merchants.
 
On a second look, the code you have should work. Tried it myself, and the /whatever was added when the script was called with ?number=whatever. If you're calling the script properly, I'd bank on the issue being with the advertiser not supporting Sub IDs for some reason.

You mean, it could be an actual issue with the advertiser (specific to the offer I'm running), and not XY7? Because I know XY7 does support subids in general. I would think that if the network (XY7 in this case) supports subids, then they track them all regardless of advertiser.

I also found this post:
http://www.wickedfire.com/affiliate-marketing/15787-tracking-copeac-nooblet-question.html#post195644

Could it be that my $id is the wrong type of variable and needs to be converted to string before it is appended to the URL?
 
Uhm...well I'm not sure how the rest of my code is relevant?
I posted all you should need to know and I know for a fact that:

Soooo...let me get this straight. YOU cannot debug your own code, yet you keen enough to determine which "bits" of code are relevant and which aren't?

If you simply posted your entire script and said "Why isn't this working?" you'd already have a solution by now. Instead you insist on posting "snippets" and expecting us to guess why it's not working.

Look, you're not going to reveal any "trade secrets" with a redirect script. If you cannot figure out your own code, then all of the code is relevant.

Johu's method is poor coding style because it is not clearly separating the code from the text strings. It would work the same, but when you're debugging your code it is always better to keep code, text and HTML as separate as possible. Other noobish coding practices include relying on magic quotes, exclusive use of <? ?> shorthand brackets and posting partial snippets of code when asking for help. Oh yeah, and instead of posting in the proper "developer" section, post it in the marketing section.
 
Soooo...let me get this straight. YOU cannot debug your own code, yet you keen enough to determine which "bits" of code are relevant and which aren't?
Hold on a minute there, WeBcYtE. No need to get all rude and pissy over this..

First of all, yes I DO know enough to know what parts are relevant here and not. It's the fucking redirect.php script we are talking about! You want me to post the html/php code to my entire landing page? What good is that gonna do? Especially when we KNOW the right value is already being passed onto the redirect script!! Come on now...

If you simply posted your entire script and said "Why isn't this working?" you'd already have a solution by now. Instead you insist on posting "snippets" and expecting us to guess why it's not working.
:error:
WTF?!? If you read my first post you will see that I DID post the entire script. Any other "snippets" were URL examples...

Look, you're not going to reveal any "trade secrets" with a redirect script.
Uuuhhhh.......did it seem like I was scared of revealing my "trade secrets" when I posted my ENTIRE 4 lines of code that is my entire redirect.php script??

Johu's method is poor coding style because it is not clearly separating the code from the text strings. It would work the same, but when you're debugging your code it is always better to keep code, text and HTML as separate as possible. Other noobish coding practices include relying on magic quotes, exclusive use of <? ?> shorthand brackets and posting partial snippets of code when asking for help. Oh yeah, and instead of posting in the proper "developer" section, post it in the marketing section.
Now you're being informative, thank you. :thumbsup:
 
Here's what you can do to check if the variable is actually being passed. In IE, paste in your redirect link script URL with the ?number=723 appended. If you're using IE7, click the "Page" button, and then click "web page privacy report". In IE6, I think you can access that from the view menu. That will give a break down of each step in the path.

Most likely, it will show that it passes it on the variable. If it does show that, you'll have to take it up with XY7, and see if they see any sub ids tracking among other affiliates for that merchant, or other merchants.


johu;
Thank you very much for that tip! Very useful tip indeed.
Now I'm actually able to see that yes indeed - the id number gets properly appended to my URL just the way I posted it. So in other words - there is nothing wrong with my code! :D

Now I need to have a talk with XY7. ;)
 
First of all, yes I DO know enough to know what parts are relevant here and not. It's the fucking redirect.php script we are talking about! You want me to post the html/php code to my entire landing page? What good is that gonna do? Especially when we KNOW the right value is already being passed onto the redirect script!! Come on now...

WTF?!? If you read my first post you will see that I DID post the entire script. Any other "snippets" were URL examples...

If you did know that you would have been able to solve your own problem. You are making a very simple thing very complicated...where does this happen, in the code that you posted:

That keyword is assigned a number, like 723 and set in the php variable $id
Let's follow your trail of stupid and see where it leads:

1) Access site:
www.homo.cum/index.php?keyword=n00bfodder

2) *keyword is assigned a number* I will not post this irrelevant code tho.

3) I pass the $id variable, which I pulled outta my ass, to a my URL:

www.homo.cum/redirect.php?number=<? echo $id; ?>

4) OMG it's not working:

<?php
$subid = trim($_GET['number']);
header( "Location: hxxp://publishers.xy7.com/z/43422/CD3149/".$subid) ;
?>

5) Better post a help thread in the marketing forum to get this straightened out...
 
WeBcYte - You're missing the point of the post. The post said that he could see that queries were being appended to the redirect script, but were not showing up in XY7's sub ID report. Once I realized that his redirection code was correct (after getting over my code n00bishness), it's FUCKING EASY to figure out if the problem is on his side or the network/merchant side. All it takes is a "web page privacy report" or a wget in linux to figure if it's being passed on properly.

I like the arguments here on WF, but not when they start to overshadow an already solved thread.
 
If you did know that you would have been able to solve your own problem. You are making a very simple thing very complicated...where does this happen, in the code that you posted:

Let's follow your trail of stupid and see where it leads:

1) Access site:
www.homo.cum/index.php?keyword=n00bfodder

2) *keyword is assigned a number* I will not post this irrelevant code tho.

3) I pass the $id variable, which I pulled outta my ass, to a my URL:

www.homo.cum/redirect.php?number=<? echo $id; ?>

4) OMG it's not working:

<?php
$subid = trim($_GET['number']);
header( "Location: hxxp://publishers.xy7.com/z/43422/CD3149/".$subid) ;
?>

5) Better post a help thread in the marketing forum to get this straightened out...

Lmao.... :D
It still isn't obvious to you is it?

The fact that my $id was PROVEN to be known and correctly passed to the redirect script.

Here's the problem explained to you as a metaphor:
- Bob prints t-shirts with an "Asshat" logo
- Jim is a reseller and gets the t-shirts from Bob
- Jim puts them all in his truck. He shows them to his friends and they all check them out - still in his truck (so we KNOW they are there, even when he leaves them)
- Jim drives them to his warehouse for storage where some workers are paid to unload them later on.
- When Jim checks the warehouse the next day, the t-shirts are gone.

Then two guys come along to figure out the problem:

WeBcYtE comes along and says:
"Hey Jim you stupid moron! Prove to me that Bob are printing these t-shirts properly! Prove to me that he gave them to you in the first place. Bob could be the source of the problem here and you're hiding shit from us you fucking n00b"

johu comes along and says:
"I suspect something is up on the RECEIVING side of this, since we know that the t-shirts were in truck already at arrival" (Duh!) "I think you should check what those warehouse workers are up to..."

Ok, so maybe I provided too much fluff at the beginning and made it seem more complicated. And I certainly provided too much shit here to respond to you, lol......

My point is - while you wasted your time attacking me, johu realized what the problem could be and actually helped me out. +rep to him.
 
  • Like
Reactions: johu
You hear that ImagesOfGayMen? Johu fixed your problem. All it needed was a little K.Y. Now you should ask about PPC advertising in the Development Section.
 
WeBcYte - You're missing the point of the post. The post said that he could see that queries were being appended to the redirect script, but were not showing up in XY7's sub ID report. Once I realized that his redirection code was correct (after getting over my code n00bishness), it's FUCKING EASY to figure out if the problem is on his side or the network/merchant side. All it takes is a "web page privacy report" or a wget in linux to figure if it's being passed on properly.

I like the arguments here on WF, but not when they start to overshadow an already solved thread.

:cool: Exactly. :cool:
 
Lmao.... :D
It still isn't obvious to you is it?

My point is - while you wasted your time attacking me, johu realized what the problem could be and actually helped me out. +rep to him.

I'm sorry, I don't have anything against gay people. I wasn't attacking you.
 
You hear that ImagesOfGayMen? Johu fixed your problem.
ORLY??? :D

Uhm...I thought it was obvious that I was aware of this when I THANKED HIM for it earlier:
http://www.wickedfire.com/affiliate...-merchant-within-php-redirect.html#post251682
;)

All it needed was a little K.Y. Now you should ask about PPC advertising in the Development Section.
Yeah I should. :)
While you go into the "And now for something completely different" section and do an in-depth study, analysis and commentary on how people's boob threads are holding back trade secrets ;) (while others oogle at the boobs like they were meant to be)
 
Try this....
Code:
<?php
  [B][COLOR=Cyan]$subid[/COLOR][/B] = trim($_GET['[COLOR=Lime][B]number[/B][/COLOR]']);
  header( "Location: [FONT=&quot][URL="http://publishers.xy7.com/z/43422/CD3149/"]hxxp://publishers.xy7.com/z/43422/CD3149/[/URL][/FONT]" . [COLOR=Cyan][B]$subid . [/B][/COLOR]"") ;
?>
 
Status
Not open for further replies.