Connecting Tech Pros Worldwide Help | Site Map

Extracting Information

Hayden Kirk
Guest
 
Posts: n/a
#1: Jul 17 '05
Does anyone know where I should start with this. Im trying to extract the
information in:
$_SERVER['HTTP_USER_AGENT'

But I dont know how to get the information out? What functions should I be
looking at. I want to get the OS, Browser, IP etc..

Thanks
Hayden Kirk


Jay Moore
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Extracting Information


Maybe try

print_r($_SERVER);

Jay

Hayden Kirk wrote:[color=blue]
> Does anyone know where I should start with this. Im trying to extract the
> information in:
> $_SERVER['HTTP_USER_AGENT'
>
> But I dont know how to get the information out? What functions should I be
> looking at. I want to get the OS, Browser, IP etc..
>
> Thanks
> Hayden Kirk
>
>[/color]

Hayden Kirk
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Extracting Information


I mean like splitting it up into sections, like an $OS string, $user_agent
string, $version string etc... Using it to store in a database to monitor
which versions of browsers and OS's come to our site,
Thanks
Hayden Kirk

"Jay Moore" <address@isp.tld> wrote in message
news:7jq7c.62708$QP.11163@twister.rdc-kc.rr.com...[color=blue]
> Maybe try
>
> print_r($_SERVER);
>
> Jay
>
> Hayden Kirk wrote:[color=green]
> > Does anyone know where I should start with this. Im trying to extract[/color][/color]
the[color=blue][color=green]
> > information in:
> > $_SERVER['HTTP_USER_AGENT'
> >
> > But I dont know how to get the information out? What functions should I[/color][/color]
be[color=blue][color=green]
> > looking at. I want to get the OS, Browser, IP etc..
> >
> > Thanks
> > Hayden Kirk
> >
> >[/color]
>[/color]


Chung Leong
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Extracting Information


Use the get_browser() function.

See http://www.php.net/manual/en/function.get-browser.php.

Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
news:Jhq7c.2678$u%1.402336@news02.tsnz.net...[color=blue]
> Does anyone know where I should start with this. Im trying to extract the
> information in:
> $_SERVER['HTTP_USER_AGENT'
>
> But I dont know how to get the information out? What functions should I be
> looking at. I want to get the OS, Browser, IP etc..
>
> Thanks
> Hayden Kirk
>
>[/color]


Hayden Kirk
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Extracting Information


Without using that function :P

Thanks,
Hayden Kirk

"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:K4udncBRFti-zMPd4p2dnA@comcast.com...[color=blue]
> Use the get_browser() function.
>
> See http://www.php.net/manual/en/function.get-browser.php.
>
> Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> news:Jhq7c.2678$u%1.402336@news02.tsnz.net...[color=green]
> > Does anyone know where I should start with this. Im trying to extract[/color][/color]
the[color=blue][color=green]
> > information in:
> > $_SERVER['HTTP_USER_AGENT'
> >
> > But I dont know how to get the information out? What functions should I[/color][/color]
be[color=blue][color=green]
> > looking at. I want to get the OS, Browser, IP etc..
> >
> > Thanks
> > Hayden Kirk
> >
> >[/color]
>
>[/color]


Jay Moore
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Extracting Information


Yeah, good luck with that since all browsers output their information
differently. :(

-Jay

Hayden Kirk wrote:[color=blue]
> I mean like splitting it up into sections, like an $OS string, $user_agent
> string, $version string etc... Using it to store in a database to monitor
> which versions of browsers and OS's come to our site,
> Thanks
> Hayden Kirk
>
> "Jay Moore" <address@isp.tld> wrote in message
> news:7jq7c.62708$QP.11163@twister.rdc-kc.rr.com...
>[color=green]
>>Maybe try
>>
>>print_r($_SERVER);
>>
>>Jay
>>
>>Hayden Kirk wrote:
>>[color=darkred]
>>>Does anyone know where I should start with this. Im trying to extract[/color][/color]
>
> the
>[color=green][color=darkred]
>>>information in:
>>>$_SERVER['HTTP_USER_AGENT'
>>>
>>>But I dont know how to get the information out? What functions should I[/color][/color]
>
> be
>[color=green][color=darkred]
>>>looking at. I want to get the OS, Browser, IP etc..
>>>
>>>Thanks
>>>Hayden Kirk
>>>
>>>[/color]
>>[/color]
>
>[/color]

Terence
Guest
 
Posts: n/a
#7: Jul 17 '05

re: Extracting Information


Hayden Kirk wrote:
[color=blue]
> Without using that function :P
>[/color]

find a list UA strings of all the browsers you anticipate will access
your website. Assume or ensure that anything that makes http requests
from your site will will not spoof this HTTP UA header. Then buy a big
bag of coffe, take a few weeks off work, and get a copy of "Mastering
Regular Expressions" from oreileys.

R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#8: Jul 17 '05

re: Extracting Information


[Top-post fixed. Please don't top-post]

"Hayden Kirk" <spam@spam.com> wrote in message news:<aDs7c.2711$u%1.403877@news02.tsnz.net>...[color=blue]
> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> news:K4udncBRFti-zMPd4p2dnA@comcast.com...[color=green]
> > Use the get_browser() function.
> >
> > See http://www.php.net/manual/en/function.get-browser.php.
> >[/color]
> Without using that function :P[/color]


Read the user notes carefully. It has the link to
<http://phpsniff.sourceforge.net/>


--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Chung Leong
Guest
 
Posts: n/a
#9: Jul 17 '05

re: Extracting Information


Well, there isn't a way. The user agent string is a complete mess. You can't
get what you want by parsing it.

Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
news:aDs7c.2711$u%1.403877@news02.tsnz.net...[color=blue]
> Without using that function :P
>
> Thanks,
> Hayden Kirk
>
> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> news:K4udncBRFti-zMPd4p2dnA@comcast.com...[color=green]
> > Use the get_browser() function.
> >
> > See http://www.php.net/manual/en/function.get-browser.php.
> >
> > Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> > news:Jhq7c.2678$u%1.402336@news02.tsnz.net...[color=darkred]
> > > Does anyone know where I should start with this. Im trying to extract[/color][/color]
> the[color=green][color=darkred]
> > > information in:
> > > $_SERVER['HTTP_USER_AGENT'
> > >
> > > But I dont know how to get the information out? What functions should[/color][/color][/color]
I[color=blue]
> be[color=green][color=darkred]
> > > looking at. I want to get the OS, Browser, IP etc..
> > >
> > > Thanks
> > > Hayden Kirk
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Hayden Kirk
Guest
 
Posts: n/a
#10: Jul 17 '05

re: Extracting Information


What about something with regular expressions?

There must be a way if there is that sniff php script...

"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:bvudnfypAuss28LdRVn-jg@comcast.com...[color=blue]
> Well, there isn't a way. The user agent string is a complete mess. You[/color]
can't[color=blue]
> get what you want by parsing it.
>
> Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> news:aDs7c.2711$u%1.403877@news02.tsnz.net...[color=green]
> > Without using that function :P
> >
> > Thanks,
> > Hayden Kirk
> >
> > "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> > news:K4udncBRFti-zMPd4p2dnA@comcast.com...[color=darkred]
> > > Use the get_browser() function.
> > >
> > > See http://www.php.net/manual/en/function.get-browser.php.
> > >
> > > Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> > > news:Jhq7c.2678$u%1.402336@news02.tsnz.net...
> > > > Does anyone know where I should start with this. Im trying to[/color][/color][/color]
extract[color=blue][color=green]
> > the[color=darkred]
> > > > information in:
> > > > $_SERVER['HTTP_USER_AGENT'
> > > >
> > > > But I dont know how to get the information out? What functions[/color][/color][/color]
should[color=blue]
> I[color=green]
> > be[color=darkred]
> > > > looking at. I want to get the OS, Browser, IP etc..
> > > >
> > > > Thanks
> > > > Hayden Kirk
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Chung Leong
Guest
 
Posts: n/a
#11: Jul 17 '05

re: Extracting Information


Nope, 'cause there isn't a well defined way to format the text string. And
the browsers all pretend to be each other. IE tells you it's Mozilla, Opera
tells you it's IE, etc. And on top of that, the OS name is screwed. Win2K is
listed as NT 5.0 while XP is NT 5.1.

The only reliable way to detect the browser type is to compare the signature
to a database of known browsers, which is what get_browser() does.

Given that few of us has the resource to support every browser under the
sun, it's probably more practical to check for specific browser. If see if
the client is IE, do strstr($_SERVER['HTTP_AGENT'], "MSIE"). To see if it's
Netscape 6 or above or something like it, look for "Gecko".

Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
news:p3L7c.2908$u%1.421103@news02.tsnz.net...[color=blue]
> What about something with regular expressions?
>
> There must be a way if there is that sniff php script...
>
> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> news:bvudnfypAuss28LdRVn-jg@comcast.com...[color=green]
> > Well, there isn't a way. The user agent string is a complete mess. You[/color]
> can't[color=green]
> > get what you want by parsing it.
> >
> > Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> > news:aDs7c.2711$u%1.403877@news02.tsnz.net...[color=darkred]
> > > Without using that function :P
> > >
> > > Thanks,
> > > Hayden Kirk
> > >
> > > "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> > > news:K4udncBRFti-zMPd4p2dnA@comcast.com...
> > > > Use the get_browser() function.
> > > >
> > > > See http://www.php.net/manual/en/function.get-browser.php.
> > > >
> > > > Uzytkownik "Hayden Kirk" <spam@spam.com> napisal w wiadomosci
> > > > news:Jhq7c.2678$u%1.402336@news02.tsnz.net...
> > > > > Does anyone know where I should start with this. Im trying to[/color][/color]
> extract[color=green][color=darkred]
> > > the
> > > > > information in:
> > > > > $_SERVER['HTTP_USER_AGENT'
> > > > >
> > > > > But I dont know how to get the information out? What functions[/color][/color]
> should[color=green]
> > I[color=darkred]
> > > be
> > > > > looking at. I want to get the OS, Browser, IP etc..
> > > > >
> > > > > Thanks
> > > > > Hayden Kirk
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread