我有一個website
(PHP)託管在雅虎的小企業和application
(爪哇)託管在Rackspace。PHP的'file_get_contents'不能從服務器工作
我正在做一個file_get_contents
從網站到應用程序。在我的本地工作正常。但是當我在服務器上部署它之後嘗試相同的操作不起作用。
在這裏,我正在發送JSON
格式的培訓列表的請求。
PHP部分
$trainingArrayJson = file_get_contents('http://mywebapplication.com/publicTraining/getTrainingsAsJson/');
$trainingArray = json_decode($trainingArrayJson);
-------
-----
這是行不通的。
,如果我做
$trainingArrayJson = file_get_contents('http://localhost:8080/publicTraining/getTrainingsAsJson/');
$trainingArray = json_decode($trainingArrayJson);
能正常工作。
參考鏈接http://stackoverflow.com/questions/7794604/file-get-contents-not-working –