Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 文件\u获取\u内容完整的图像、脚本代码_Php_Html_Stream_File Get Contents - Fatal编程技术网

Php 文件\u获取\u内容完整的图像、脚本代码

Php 文件\u获取\u内容完整的图像、脚本代码,php,html,stream,file-get-contents,Php,Html,Stream,File Get Contents,是否有任何方法可以获得完整的源代码与图像,脚本谁是在页面中使用。。。文件\u获取\u内容只提供没有图像的元素,脚本。。。我需要的是捕获一些URL(file\u get\u contents/echo$URL)以像iframe一样呈现页面。(与图像,脚本等)这是可能的,有任何功能,为 <?php $URL='www.example.com'; $data= file_get_contents($url); echo $data; ?> 我认为不存在用于此的内置函数。但是你可以写

是否有任何方法可以获得完整的源代码与图像,脚本谁是在页面中使用。。。文件\u获取\u内容只提供没有图像的元素,脚本。。。我需要的是捕获一些URL(file\u get\u contents/echo$URL)以像iframe一样呈现页面。(与图像,脚本等)这是可能的,有任何功能,为

<?php

$URL='www.example.com';
$data= file_get_contents($url);
echo $data;

?>


我认为不存在用于此的内置函数。但是你可以写,应该不会太难。

解决方案很简单:

<?php

$url = 'http://www.example.com/';

$data = file_get_contents($url);

$data = '<head><base href='.$url.' target="_blank" /></head>'.$data;

echo $data;


?>

没有内置的。使用外部工具更容易。例如,
wget--mirror
还可以下载资源并将引用转换为本地路径。可能的重复