0
我需要連接到本地端口(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);
在本地局域網上,如果其中一臺pc是linux的...使用ip調用「localhost」不是pc的名稱 – 2015-03-02 12:46:56
嗨Marco ..只有服務器安裝了linux ..所有其他PC都是windows xp或7 ..我試着打電話給computerip:8046,但不工作... – diego 2015-03-02 15:21:44
@MarcoMura我搜索,我發現像跨域域的東西..你認爲它可以幫助嗎? – diego 2015-03-03 16:16:55