Fernando Oliveira Fernando Oliveira - 4 months ago 49
PHP Question

how to detect fake mobile traffic without use user agent in PHP?

Can anyone tell me how to detect fake mobile traffic?

I was detecting device type (mobile or not mobile device)
by analyzing User Agent value in header from

$_SERVER['HTTP_USER_AGENT']
in PHP.

But I know now that exists an User Agent Switcher.

Answer

If You want to defend from site scrapers, software ddos attacks (don't downvote me (: ) You've 3 ways:

1) use some service like CloudFlare to defend from parasitic traffic (ddos, site scraping). will be easy and will take less time. - CALL IT "THIRD-PARTY SERVICE"

2) develop web server that will intellectually detect parasitic requests by principle: "less time between requests". needs understanding of http(s) requests and proficiency developing system level apps. - CALL IT "INVENTING CUSTOM WEB SERVER WITH SELF INVENTED FIREWALL" (:

3) make "software firewall" inside Your apps code that will log requests to some database (better use redis-server with storing data with timeout) and detect again by "less time between requests" principle and set block for IP address for 1 minute or more. easy to develop, but will make performance loads on database, better use no-sql storages like redis or caching memcache. - CALL IT "I'LL DO IT MYSELF WITH WHAT I HAVE"

My choise: CloudFlare (1) because no time to invent the wheel, no time to write and modify custom code and etc.