(PHP)警告:file_get_contents()[function.file get contents]:无法';无法解析主机名
我需要一些帮助来修复我的代码。我环顾四周,没法让它工作。以下是我收到的错误消息: 警告:file_get_contents()[function.file get contents]:无法解析第13行/home/a9317671/public_html/prox/get.php中的主机名 警告:file_get_contents()[function.file get contents]:无法打开流:第13行的/home/a9317671/public_html/prox/get.php中的操作失败 我的代码:(PHP)警告:file_get_contents()[function.file get contents]:无法';无法解析主机名,php,html,forms,Php,Html,Forms,我需要一些帮助来修复我的代码。我环顾四周,没法让它工作。以下是我收到的错误消息: 警告:file_get_contents()[function.file get contents]:无法解析第13行/home/a9317671/public_html/prox/get.php中的主机名 警告:file_get_contents()[function.file get contents]:无法打开流:第13行的/home/a9317671/public_html/prox/get.php中的操作
<!DOCTYPE html>
<html>
<body>
<form name='form' method='post' action="get.php">
ULR (no https/https): <input type="text" name="name" id="name" ><br/>
<input type="submit" name="submit" value="Submit">
</body>
</html>
您使用的URL错误: 应该是:
下次调试类似的东西时。尝试查看这段代码正在执行的操作并手动尝试,因此在这种情况下,只需在浏览器中转到此url即可提供一些信息。字符串中的
http://
协议增加了一倍。我将此标记为“一个简单的印刷错误”因为主机是以文本形式传递的,并且修复程序不太可能在将来帮助任何人。
<?php
$length = 10;
$fname= substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
$name = $_GET['name'];
echo $name;
echo "The is a test. File will be at: http://ben-nottelling.comlu.com/prox/$fname.html";
file_put_contents($fname.html, file_get_contents("http://http://ben-nottelling.comlu.com/"));
?>