I'm admittedly new to PHP, so I need help.
I am creating an independent affiliate program for my site and I have the opportunity for an affiliate to add SubID to their tracking link. Without control over what was entered, I tested various scenarios and found an error entering the full URL (for example, http://example.com ").
In my PHP, I can grab a variable from a string without any problems. My problem occurs when I get the link url and parse it (since I need to parse the link url to get the grid host for other purposes). Code below:
$refURL = getenv("HTTP_REFERER");
$parseRefURL = parse_url($refURL);
WORKS when an incoming link (for example):
http://example.com/?ref=REFERRER'S-ID&sid=www.test.com
ERROR on incoming link (note the addition of "http: //" after "sid ="):
http://example.com/?ref=REFERRER'S-ID&sid=http://www.test.com
Here is a warning:
Warning: parse_url (/? Ref = REFERRER'S-ID & sid = http://www.test.com ) [function.parse-url]: Unable to parse URL in / home 4 / 'directory' / public_html / hosterdoodle / header.php on line 28`
Any ideas on how to save the parse-url drop function when someone can decide to place the url in a variable? (I actually tested this problem to such an extent that it will throw an error with the same value as ": /" in the variable)
source
share