parse_url($HTTP_REFERER) not returning any values
Moderator: General Moderators
parse_url($HTTP_REFERER) not returning any values
parse_url($HTTP_REFERER)
I cannot seem to get this function call to return an array of values(returns nothing) ON my localhost.
I have done some research and came across some different ideas as to why its not returning
1. My Firewall is stripping this info
2. Apache is not configured properly
3. php is not configured properly
I am running php4.1.3 and apache2 on XP
Can anyone help, this thing has killed hours of productivity
Thanks in advance
I cannot seem to get this function call to return an array of values(returns nothing) ON my localhost.
I have done some research and came across some different ideas as to why its not returning
1. My Firewall is stripping this info
2. Apache is not configured properly
3. php is not configured properly
I am running php4.1.3 and apache2 on XP
Can anyone help, this thing has killed hours of productivity
Thanks in advance
Last edited by rsraloha on Thu Jul 06, 2006 12:36 pm, edited 1 time in total.
have you tried instead?
btw - don't forget HTTP_REFERER doesn't always have a value and is infact, unreliable.
Code: Select all
$vars = parse_url($_SERVER['HTTP_REFERER']);btw - don't forget HTTP_REFERER doesn't always have a value and is infact, unreliable.
Ya I am assigning
$url = parse_url($_SERVER['HTTP_REFERER']);
I know it is unreliable but I have taken over an application that uses it
and I am trying to simpy get the application running before I go tweaking anything
BTW this code is returning and functional in production, it will
not work on my local environment.
thanks
$url = parse_url($_SERVER['HTTP_REFERER']);
I know it is unreliable but I have taken over an application that uses it
and I am trying to simpy get the application running before I go tweaking anything
BTW this code is returning and functional in production, it will
not work on my local environment.
thanks
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I am sure there is a better solution than using this server variable
But,
I am working with an app that is live in production and am trying to get
the stable version from the production server running on my machine without modifying any code
how can I configure my server to return this info
LocalHost is Apache2.0 and
Production Server is the same
Is this an apache config issue.
But,
I am working with an app that is live in production and am trying to get
the stable version from the production server running on my machine without modifying any code
how can I configure my server to return this info
LocalHost is Apache2.0 and
Production Server is the same
Is this an apache config issue.
- mattcooper
- Forum Contributor
- Posts: 210
- Joined: Thu Mar 17, 2005 5:51 am
- Location: London, UK
Have you tried something like this?
You'll get output when you click the link. You should be able to see the referer from the components of the $url array.
Hope this helps.
Code: Select all
echo "<a href = ". $_SERVER['PHP_SELF'] .">Click me</a>";
echo "<p>referer:". $_SERVER['HTTP_REFERER'] ."</p>"; // confirms there is no prob with server settings; once you've clicked, you get the referer
$url = parse_url($_SERVER['HTTP_REFERER']);
echo "URL: - ".$url['scheme'];$url['host'];$url['path']; // This should echo out the referrer from $urlHope this helps.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Anything of this manner will really be makeshift. You could try __FILE__, but it's difficult to do with directory structures.
My recommendation is that when you have the resources and ability to do so, define a clear format for representing pages and then pass that to the page that will bounce the client back to the previous page.
My recommendation is that when you have the resources and ability to do so, define a clear format for representing pages and then pass that to the page that will bounce the client back to the previous page.