[Solved] Prevent User Agent malicious code with PHP [closed]

Exactly the same way you should already prevent injection with every other value. That it’s specifically a user agent string is irrelevant. When writing it to an HTML page, pass it through htmlspecialchars: echo htmlspecialchars($user_agent);. When using it as part of a database query, use prepared statements, or whatever escaping function the the database API … Read more

[Solved] I believe my scraper got blocked, but I can access the website via a regular browser, how can they do this? [closed]

I am wondering both how the website was able to do this without blocking my IP outright and … By examining all manner of things about your request, some straight-forward and some arcane. Straight-forward items include user-agent headers, cookies, correctly spelling of dynamic URLs. Arcane items include your IP address, the timing of your request, … Read more