|
-
May 10th, 2006, 07:57 AM
#1
Thread Starter
Frenzied Member
How to log $_SERVER['HTTP_USER_AGENT'] to a file
Hi all . Could any one show me how i can log $_SERVER['HTTP_USER_AGENT'] to a file. I want to point diffrent programs to it to see what string they send.Thanks
-
May 10th, 2006, 08:43 AM
#2
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
- Open file
- Append UA string
- Close file handle
Do you need cod?
-
May 10th, 2006, 08:56 AM
#3
Thread Starter
Frenzied Member
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
penagate thank u for u reply. yes i need the code i just want to point diffrent sofware to it to see what strings they send.Thanks
-
May 10th, 2006, 09:01 AM
#4
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
Code:
// Open log in append mode. If it doesn't exist it will be created.
$file = fopen('ua-strings.txt', 'a');
// Append the UA string
fwrite($file, $_SERVER['HTTP_USER_AGENT'].'\n');
// Close
fclose($file);
-
May 10th, 2006, 10:17 AM
#5
Thread Starter
Frenzied Member
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
 Originally Posted by penagate
Code:
// Open log in append mode. If it doesn't exist it will be created.
$file = fopen('ua-strings.txt', 'a');
// Append the UA string
fwrite($file, $_SERVER['HTTP_USER_AGENT'].'\n');
// Close
fclose($file);
thank u for u reply. Could tell me how in both php and visual basic app i can change the default string sent to $_SERVER['HTTP_USER_AGENT'] log file? For example if the default is :Microsoft URL Control - 6.00.8862\n
and i want to send this :
Media Player Classic\nMedia Player Classic\nshoutcastsource\nMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; {BE6B3C18-D43F-BBA3-8046-F416968AB502}; (R1 1.5))\n
-
May 10th, 2006, 12:56 PM
#6
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
 Originally Posted by tony007
Could tell me how in both php and visual basic app i can change the default string sent to $_SERVER['HTTP_USER_AGENT'] log file?
Well PHP won't be sending a UA but if you want to do it in VB, you'll want to post into the VB forums.
Most controls for VB have a UA Microsoft created and you'd have to completely write your own control to have a custom UA.
-
May 11th, 2006, 03:41 AM
#7
Re: How to log $_SERVER['HTTP_USER_AGENT'] to a file
I do apologise. I meant the UA strings to be on separate lines. However I used the wrong quote marks 
The second line should be thus:
PHP Code:
fwrite($file, $_SERVER['HTTP_USER_AGENT']."\n");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|