facebook(不同?)来自喜欢和分享的用户代理爬虫?
我现在正在一个网站上工作。整个网站都受到保护,因此只有登录用户才能访问该网站(只要 Beta 测试正在进行 -> 有限时间)。
我们的网站上有两种不同类型的共享。一种是简单的“喜欢”按钮,另一种仅使用: http://www.facebook.com/sharer/sharer.php?u={URL}
为了向 facebook Crawler 提供访问权限,我建立了此保护:
if(wUserCur::isLoggedIn() || in_array($currentPath, $allowedLogins) || strstr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit')):
// do nothing
else:
wResponse::redirect('/de/register/index.php');
endif;
我知道它不安全,但此网站并不意味着要分类。
这里最重要的是,这适用于 http://www.facebook.com/ sharer/sharer.php?u= 很好,但是如果我点击“喜欢”按钮,它会将爬虫重定向到注册页面。
有不同的facebookCrawler吗?或者还有更好的可能性吗?
感谢您的帮助。
i am working right now on a website. This whole Website is protected, so only logged in user can access this website (as long as the beta test is running -> limited time).
We have 2 two different types of sharing on our site. One is the simple "Like" button and the other one just uses:
http://www.facebook.com/sharer/sharer.php?u={URL}
In order to give access for the facebook Crawler i build this protection:
if(wUserCur::isLoggedIn() || in_array($currentPath, $allowedLogins) || strstr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit')):
// do nothing
else:
wResponse::redirect('/de/register/index.php');
endif;
i know its unsecure but this site isn't meant to be classified.
The big deal here is, that this works for http://www.facebook.com/sharer/sharer.php?u= very well, but if i hit the like button it redirects the crawler to the register page.
Are there different facebookCrawler? Or is there a better possibility?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个功能应使用相同的用户代理
当前部署的爬虫具有用户代理
或
理论上版本号可能会在某个时刻增加,但目前为 1.0 或 1.1
Both features should use the same user agent
The currently deployed crawlers have the user agents
or
In theory the version number could increment at some point, but currently it's 1.0 or 1.1