如何识别卷曲请求 [英] How to identify curl request

查看:153
本文介绍了如何识别卷曲请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在我的脚本中检测请求是来自普通的Web浏览器还是某些执行curl的脚本。我可以看到标题,可以与用户代理和其他几个标题区分,但在curl假标题可以设置,所以我无法跟踪请求。

Is there a way to detect in my script whether the request is coming from normal web browser or some script executing curl. I can see the headers and can distinguish with "User-Agent and other few headers" but in curl fake headers can be set, so i am not able to track the request.

请建议我识别卷曲或其他类似非浏览器请求的方法。

Please suggest me ways about identifying the curl or other similar non browser request.

推荐答案

捕获大多数自动化的唯一方法请求是在逻辑中编码,以便通过浏览器发现不可能是人类的活动。

The only way to catch most "automated" requests is to code in logic that spots activity that couldn't possibly be human with a browser.

例如,点击页面太快,填写表格太快,在html文件中有一个外部源(如通过php文件伪造的css文件),并检查请求的IP是否已在您网站的上一阶段下载(有点像反向蜜罐),但您需要排除某些IP /用户代理被阻止,否则您将阻止Google的webspiders。等等。

For example, hitting pages too fast, filling out a form too fast, have an external source in the html file (like a fake css file through a php file), and check to see if the requesting IP has downloaded it in the previous stage of your site (kind of like a reverse honeypot), but you would need to exclude certain IP's/user agents from being blocked, otherwise you'll block google's webspiders. etc.

如果curl(或任何其他自动脚本)伪装其标题看起来像浏览器,这可能是唯一的方法。

This is probably the only way of doing it if curl (or any other automated script) is faking its headers to look like a browser.

这篇关于如何识别卷曲请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆