I want to find out who a network is brokering offers from. I know it is possible to find it through tracing the redirects of the affiliate link, but completely forget how. Anyone wanna help me out?
sounds like a useful tool we could all use.
if you guys start listing off known tracking link domains and what networks own them I'll whip up a quick tool to follow redirects and identify networks from them.
Does anybody have the source code (or knows where to get the source code) for a tool like this?
I'm looking at using a script like this internally for a project I have and there's no reason for me to code this from scratch if source code for this script already exists.
// Find location of redirect
function loc_redirect($url) {
# 1. Prevent redirects
$opts = array('http' =>
array('max_redirects'=>1,'ignore_errors'=>1)
);
stream_context_get_default($opts);
# 2. Get headers (does not take context argument like file_get_contents)
$headers = get_headers($url,true);
# 3. Restore stream settings
$opts = array('http' =>
array('max_redirects'=>20,'ignore_errors'=>0)
);
stream_context_get_default($opts);
# 4. Extract http request status code
$status = $headers[0];
list($protocol,$code,$message) = split(' ',$status,3);
# 5. Find redirect
return ($code>=300 && $code<400) ? $headers['Location'] : FALSE;
}