Connecting Tech Pros Worldwide Help | Site Map

Extracting Information

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 04:20 AM
Hayden Kirk
Guest
 
Posts: n/a
Default Extracting Information

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



  #2  
Old July 17th, 2005, 04:20 AM
Jay Moore
Guest
 
Posts: n/a
Default 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]

  #3  
Old July 17th, 2005, 04:20 AM
Hayden Kirk
Guest
 
Posts: n/a
Default 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]


  #4  
Old July 17th, 2005, 04:20 AM
Chung Leong
Guest
 
Posts: n/a
Default 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]


  #5  
Old July 17th, 2005, 04:20 AM
Hayden Kirk
Guest
 
Posts: n/a
Default 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]


  #6  
Old July 17th, 2005, 04:20 AM
Jay Moore
Guest
 
Posts: n/a
Default 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]

  #7  
Old July 17th, 2005, 04:20 AM
Terence
Guest
 
Posts: n/a
Default 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.

  #8  
Old July 17th, 2005, 04:20 AM
R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
Default 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
  #9  
Old July 17th, 2005, 04:21 AM
Chung Leong
Guest
 
Posts: n/a
Default 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]


  #10  
Old July 17th, 2005, 04:21 AM
Hayden Kirk
Guest
 
Posts: n/a
Default 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]


  #11  
Old July 17th, 2005, 04:22 AM
Chung Leong
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.