我使用这个脚本发送POST给误差不和获取文件和他的内容和处理请求PHP的file_get_contents在服务器本地
$postdata = http_build_query(
array(
'inUsername' => ''.$_REQUEST['inUsername'].'',
'inPassword' => ''.$_REQUEST['inPassword'].'',
'csfr_token' => ''.$_REQUEST['csfr_token'].''
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result2 = file_get_contents('http://cp.ufowebs.com/index.php', false, $context);
$result="Invalid";
if (eregi($result,$result2))
{
print '{"login":"ok"}';
}
else
{
print "ok";
header("Location:http://cp.ufowebs.com/index.php");v<meta http-equiv="refresh" content="2;url=http://cp.controlpanel.com/index.php">
}
}
?>
在本地或从其他网址工作正常,但在相同的网址或者去子域,等等,没有作品,给我这个错误总是:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/hostdata/admin/public_html/domain_com/test_cp.php on line 94 Warning: file_get_contents(http://cp.domain.com/index.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/hostdata/admin/public_html/domain_com/test_cp.php on line 94 ok
我不知道为什么其他领域的作品,并没有在同一个域等
在'hosts'中增加了'cp.domain.com'? – SparKot 2013-02-26 20:15:14
是的,我把主机放入服务器的权利,但继续问题,我不知道为什么 – user1860536 2013-02-26 20:40:33
好吧,这是csf的问题,阻止这种类型的连接,但如何我可以取消阻止,如果csf启用? – user1860536 2013-02-26 20:46:17