从外部网站获取所有脚本
我这里有一些代码,我用这个代码渲染外部页面(类似于 iframe),但我得到了源代码。但是当我开始我的代码时,一切都很好,但那里显示一个窗口,我无法关闭它来查看内容。这是代码: 代码:
<?php
$url = 'http://www.kupime.com/';
$data = file_get_contents($url);
$data = '<head><base href='.$url.' target="_blank" /></head>'.$data;
echo $data;
?>
这会生成一个很好的 HTML 页面,但要关闭窗口,我还需要使用此书签获取所有脚本
javascript: (function(){
s = document.getElementsByTagName('SCRIPT');
tx = '';
sr = [];
for (i = 0; i < s.length; i++) {
with (s.item(i)) {
t = text;
if (t) {
tx += t;
}
else {
sr.push(src)
};
}
};
with (window.open()) {
document.write('<textarea%20id="t">' + (sr.join("\n")) + "\n\n-----\n\n" + tx + '</textarea><script%20src="http://jsbeautifier.org/beautify.js"></script><script>with(document.getElementById("t")){value=js_beautify(value);with(style){width="99%";height="99%";borderStyle="none";}};</script>');
document.close();
}
})();
但是我如何在上面的代码中实现这一点?这是第一个演示(仅 php 代码) http://www.pluspon.com/get1.php< /a> 或者也许用一些 wget 来做到这一点?
I have a some code here and I with this code render external page (similar to iframe) but I got a source code. But when I start my code all is good but one window is showing there and I can't to close his to see contents. Here is the code:
Code:
<?php
$url = 'http://www.kupime.com/';
$data = file_get_contents($url);
$data = '<head><base href='.$url.' target="_blank" /></head>'.$data;
echo $data;
?>
and this generate a good HTML page but to close window I need also to get all scripts with this bookmarklet
javascript: (function(){
s = document.getElementsByTagName('SCRIPT');
tx = '';
sr = [];
for (i = 0; i < s.length; i++) {
with (s.item(i)) {
t = text;
if (t) {
tx += t;
}
else {
sr.push(src)
};
}
};
with (window.open()) {
document.write('<textarea%20id="t">' + (sr.join("\n")) + "\n\n-----\n\n" + tx + '</textarea><script%20src="http://jsbeautifier.org/beautify.js"></script><script>with(document.getElementById("t")){value=js_beautify(value);with(style){width="99%";height="99%";borderStyle="none";}};</script>');
document.close();
}
})();
But how can I implement this in my code above? Here is the demo of first (only php code) http://www.pluspon.com/get1.php or maybe to do this with some wget?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
黑客方式:如果你只是想摆脱窗口,你只需要添加隐藏该窗口元素的CSS。
by,嗯..也许是这样的:
如果这种方式太愚蠢了,请原谅我..
hack way : if you just want to get rid of the window, you just need to add css that hide that window element.
by, umm..perhaps like this :
well pardon me if this way is too stupid..