我需要连接到本地端口(8046)才能执行安装在本地计算机上的服务。如果我启动本地服务器(如Wamp或PHPDesktop),则没有问题,但如果我创建了Linux服务器(位于同一网络中)并且想要调用服务,该怎么办?有没有办法做到这一点?从远程服务器连接到本地主机
我试图获取计算机名称并连接到compname:8046,但它不工作;有什么建议么?
$xml='---req--'
$url = 'http://127.0.0.1:8046';
$post_data = array(
"xml" => $xml,
);
$stream_options = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: application/xml; charset=UTF-8",
'content' => urldecode(http_build_query($post_data)),
'timeout' => 12000,
),
);
$context = stream_context_create($stream_options);
$response = @file_get_contents($url, null, $context);
2015-03-02
diego
+0
在本地局域网上,如果其中一台pc是linux的...使用ip调用“localhost”不是pc的名称 –
2015-03-02 12:46:56
+0
嗨Marco ..只有服务器安装了linux ..所有其他PC都是windows xp或7 ..我试着打电话给computerip:8046,但不工作... –
2015-03-02 15:21:44
+0
@MarcoMura我搜索,我发现像跨域域的东西..你认为它可以帮助吗? –
2015-03-03 16:16:55