Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Detecting affiliate links
Old 03-14-2008, 12:20 PM Detecting affiliate links
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Just wondering if anyone has any suggestions for detecting affiliate links with PHP. As an example, say that I'm creating a comments section for my website and I want to allow regular links in the comments, but not affiliate links. What would be the best way to go about that?

From an SEO perspective, it would probably be wise to 'no-follow' all user-submitted links anyways, but I would like to try to weed out the affiliates if I can as well.

I suspect that regular expressions could help, but I'm not familiar with all of the different affiliate link formats. Also, I would worry a little about false positives. I could probably also check the url against an array of common affiliate sites like clickbank, etc. However, using that method would require that a large list of affiliate sites be maintained.

I'll probably end up using a combination of the above, but I would love to get some more input if anyone else has ideas as well.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
 
Register now for full access!
Old 03-14-2008, 12:58 PM Re: Detecting affiliate links
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Most affiliate links I've seen just use url parameters. This might break user's abilities to post certain non-affliliate links, but you could just cut off everything after the ? in a url. By this I mean:
Code:
http://mydomain.com/index.php?affiliateRef=11111
//turns into
http://mydomain.com/index.php
All you would have to do is use explode to split the link.
PHP Code:
$link 'http://mydomain.com/index.php?affiliateRef=11111';
$linkArray explode('?'$link);
$newLink $linkArray[0]; 
Hope that helps
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-14-2008, 01:12 PM Re: Detecting affiliate links
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Thanks, NullPointer. I did consider that, but there are so many non-affiliate sites that use url parameters that I didn't want to go down that route if I could help it.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 03-14-2008, 04:21 PM Re: Detecting affiliate links
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
I think NullPointer basically covered what you need to do. Personally I would use a preg_replace ( http://uk2.php.net/manual/en/function.preg-replace.php ) though, and possibly encode the URL's so that when they leave they go via a "Your now leaving my website" page.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-03-2008, 12:48 PM Re: Detecting affiliate links
Average Talker

Posts: 22
Name: Jeremy Smith
Trades: 0
there are so many ways to cloak affiliate links though. it would be impossible to catch them. many people use url shortening services, some have scripts running on their websites so that the url looks normal. it's more trouble than it's worth.
__________________

Please login or register to view this content. Registration is FREE
thewebdude76 is offline
Reply With Quote
View Public Profile Visit thewebdude76's homepage!
 
Reply     « Reply to Detecting affiliate links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14824 seconds with 12 queries