Comments (4)
They don't really have anything in common that I can grab onto, so it would require a hard coded list of "bots". That's not really practical at this point while still trying to keep this thing minimal I'm afriad.
from phpuseragent.
In my website I added a check to know if the client is a bot or not. After calling parse_user_agent, if $user_agent['platform'] is NULL I just run this regex, which seems reliable to detect all the major bots (considering that it is run after user agent detection failed, false positive are almost impossible). I paste it here in case it can be useful :-)
preg_match('/bot|crawl|slurp|spider|cloudflare/i', $_SERVER['HTTP_USER_AGENT'])
from phpuseragent.
(Now) there are some bots in Currently Detected Browsers.
echo $ua->platform() . PHP_EOL;
echo $ua->browser() . PHP_EOL;
echo $ua->browserVersion() . PHP_EOL;
Is it possible to add $ua->isBot()
?
from phpuseragent.
@luigifab Per the README,
This is not meant as a browser "knowledge engine" but rather a simple parser. Anything not adequately provided directly by the user agent string itself will simply not be provided by this.
https://github.com/donatj/PhpUserAgent#what-it-does-not-do
There is no reliable way to know if something is a bot or not without maintaining a list of UA's known to be bots.
@lucaferrario 's method of checking if the platform is null may or may not be good enough for your purposes, but it's not reliable enough to codify.
from phpuseragent.
Related Issues (20)
- No recognition of e-mail clients HOT 2
- Add user_agent initial string to output HOT 2
- Support Chrome based MS Edge
- Ruby port HOT 2
- Rename Macintosh to Mac HOT 5
- Opera Next HOT 2
- Chrome User Agent phase out HOT 13
- UC Browser not detected HOT 1
- Detect Applebot HOT 1
- Instagram and Snapchat browsers HOT 6
- Can Not Detect iPadOS 13+ HOT 1
- Consider supporting smart TV UA strings. HOT 1
- Link Preview user agent - such as in iMessage or Telegram? HOT 3
- Googlebot Mobile not Detected HOT 2
- [New] Device Detector API Beats Regex Solutions HOT 2
- Incorrect browser detected for "Motorola Edge" HOT 2
- Version of operation system (Android and iOS) HOT 1
- Consistent detection of "Safari shells" in iOS HOT 13
- object mode HOT 3
- Can you add more Chinese browsers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpuseragent.