如何找到哪个域从我的服务器请求iframe并将域保存在数据库中 [英] How can i find which domain requests an iframe from my server and save domain on database
问题描述
由于各种原因,我有一组各种网站从我的服务器请求 iframe
html文件
I have a set of various websites requesting an iframe
html file from my server for various reasons
是可以跟踪 onload
哪个域请求 iframe
然后将其保存在数据库中。
Is it possible to track onload
which domain requests the iframe
and then save it on a database.
如果域已经存在,则不要将其添加到数据库中。
If the domain already exists then don't add it to the database.
推荐答案
它不是请求iframe内容的域,它是用户的浏览器。
It is not the domain that requests the contents for the iframe, it is the user's browser.
稍微有机会看到此iframe所在的页面:引荐来源(错误地在标准文档中拼错为referer,因此每个浏览器都必须复制此拼写错误),可通过$ _SERVER ['HTTP_REFERER']在PHP中获得。
There is a slight chance to see which page this iframe is on: The referrer (mistakenly misspelled in the standard document as "referer", so every browser had to copy this typo), available in PHP via $_SERVER['HTTP_REFERER'].
你可以尝试从那里解析域名,最好使用 parse_url()。
You can try and parse the domain from there, best by using parse_url().
这篇关于如何找到哪个域从我的服务器请求iframe并将域保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!