我的服务器上的网站屏幕截图取决于用户
我遇到了很多类似的问题,但我找不到简单的答案。我的目标是在我的服务器上为特定用户创建网页缩略图(取决于SESSION
)。网站是动态的,每个不同的用户内容都会发生变化,就像Facebook上的用户内容一样。
我在这里需要做的是,当用户遇到应用程序问题时生成屏幕截图,然后单击捕获按钮
我有很多选项,例如
- libwkhtmltox
- wkhtmltopdf
但没有得到我应该使用的选项,也建议其他更好的选项。
我有linux服务器并使用核心PHP并且可以通过shell访问它。
请不要引用外部网站,因为在我的情况下他们无法获取快照(正如我所说的SESSION
变量是为每个用户维护的)。
请帮助我完成教程。
提前致谢
I came upon many similar questions like this but I could not find simple answer. My goal is to create my web page thumbnail onto my server for a particular User (depending on SESSION
). Website is dynamic means for every different user content changes like that contents of users on facebook.
What I need to do here is generate a screenshot when user experiences a problem with the application and click the capture button
I got many options like
- libwkhtmltox
- wkhtmltopdf
but not getting which I should use also suggest other if better.
I have linux server and using core PHP and have shell access to it.
Please don't refer external site as they are unable to get snapshot in my case (as I said SESSION
variable is maintained for every user).
Please help me with the tutorial.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
libwkhtmltox
和wkhtmltopdf
都是捕获网页图像的出色技术。然而,问题在于,让这些技术与您的用户拥有相同的会话是非常困难的,即使不是不可能。此外,用户遇到的许多错误在第二次请求时无法重现。 (由数据库连接错误、缓存等引起的错误)所以这样做的价值有限。一种替代方法是在他们单击发送错误页面快照
时抛出一个弹出窗口,解释如何截取屏幕截图。如果你绝对想走这条自动化屏幕截图的道路,这里有一个疯狂的、可能是愚蠢的、不安全的想法。由于
wkhtmltopdf
是基于 webkit 构建的,因此有设置 cookie 的选项。只要您的 phpsession
是基于 cookie 的,您就可以将用户的session_id
传递给wkhtmltopdf
,并劫持您自己的用户会话,从而重新创建当wkhtmltopdf
发出请求时的页面。我因为建议这个而被否决了......libwkhtmltox
andwkhtmltopdf
are both great technologies for capturing images of web pages. However, the problem is that it's really hard to get these technologies to have the same session as your user, if not impossible. Additionally, many errors users experience aren't reproducible on a second request. (Errors caused by db connection errors, caching, etc.) So doing something like this will have limited value. One alternative would be to throw a popup when they click yoursend errorpage snap
that explains how to take a screenshot.If you absolutely want to go down this path of automating the screenshot, here's a crazy, probably stupidly insecure idea. As
wkhtmltopdf
is built on webkit, there are options to set cookies. As long as your phpsession
is cookie based, you could pass the user'ssession_id
towkhtmltopdf
, and hijack your own user's session, thereby recreating the page whenwkhtmltopdf
makes the request. I'm so getting downvoted for suggesting this...