我有以下的PHP代碼充當代理我的http服務器
slavePref.php
<?php
$url = 'http://xyzdei/IPDWSRest/Service1.svc/getServerUtil';
$callback = $_GET["callback"];
echo($callback . "(");
header('Content-Type: application/json; charset=utf8');
echo(file_get_contents($url . '/' . $_GET["poolingServer"], $_GET["serverPID"]));
echo (")");
?>
託管在IIS web服務具有以下合同
[OperationContract]
[FaultContract(typeof(ExceptionOnIPDWS))]
[WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "getServerUtil/{poolingServer}&{serverPID}", ResponseFormat = WebMessageFormat.Json, Method = "GET")]
//Status getServerUtil(string poolingServer,string serverPID, ref string oCreateResult);
string getServerUtil(string poolingServer, string serverPID);
從瀏覽器我想打電話給URI作爲
的http:// :1136/slavePerf.php poolingServer = thunderw7dei & serverPID = 23456
但是該請求被以下消息
>
Notice: Undefined index: callback in C:\Users\xom\Documents\My Web
> Sites\EmptySite2\slavePerf.php on line 4 (Warning:
> file_get_contents(http://xomw764dei/IPDWSRest/Service1.svc/getServerUtil/thunderw7dei):
> failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in
> C:\Users\xom\Documents\My Web Sites\EmptySite2\slavePerf.php on line 8
>)
失敗?。我認爲我沒有正確傳遞參數
「但是請求失敗」 - > Errormessage? – 2014-09-11 09:20:42
@EdiG。我已更新錯誤消息 – 2014-09-11 09:23:02
您的請求部分中是否有URL中的參數'callback'? – 2014-09-11 09:30:35