SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Jun 9, 2008, 12:02 #1
- Join Date
- Apr 2007
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Undefined index: HTTP_REFERER in /var/www/file.php
Help me once more and I am done with my error log. The error is:
Undefined index: HTTP_REFERER in /var/www/file.php
============ PHP CODE===============
//get referer log
if (!preg_match("/Mediapartners-Google/", $_SERVER['HTTP_USER_AGENT'])) {
get_logs($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);
}
===================================
TIA.
-
Jun 9, 2008, 12:11 #2
Not all user agents will set this, it cannot really be trusted.
my mobile portal
ghiris.ro
-
Jun 9, 2008, 12:26 #3
- Join Date
- Apr 2007
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The question is not the User Agent. The question is PHP Notice: Undefined Index? What is meant by this?
Thanks.
-
Jun 9, 2008, 12:35 #4
-
Jun 9, 2008, 12:43 #5
-
Jun 9, 2008, 12:45 #6
- Join Date
- May 2002
- Location
- United States :)
- Posts
- 1,691
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jun 9, 2008, 13:17 #7
- Join Date
- Apr 2007
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, now understand. I really appreciate if you can help with some alternative piece of code? I really need to log referer from Google only. Building sort of keyword list Google sending to me.
Again thanks for any help you can offer me.
-
Jun 9, 2008, 13:46 #8
Here's a very simple version of what you're asking for
PHP Code:if (stripos($_SERVER['HTTP_REFERER'], 'www.google.com')) {
parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $qry);
echo $qry['q'];
}
-
Jun 9, 2008, 20:54 #9
- Join Date
- Mar 2004
- Location
- Kenneth City, FL
- Posts
- 823
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What happens if you place this above "//get referer log" ?
Code:if( empty( $_SERVER['HTTP_REFERER'])) { $_SERVER['HTTP_REFERER'] = getenv('HTTP_REFERER'); }
Bookmarks