0
こんにちは私はPHPで単純なXML-RPCクライアントを書くためにソンムの問題があります。 これは私のPHPコードです:PHPでlocalhost xml_rpcクライアントを実装する方法は?
$site_name = "Mikangali";
$site_url = "http://www.mikangali.com";
$site_url = "http://localhost";
$request = xmlrpc_encode_request("weblogUpdates.ping", array($site_name, $site_url));
#echo $request;
$http_request = array(
'method' => "POST",
'header' => "Content-Type: text/xml\r\nUser-Agent: PHPRPC/1.0\r\nHost: rpc.technorati.com\r\n",
'content' => $request
);
#print_r($http_request) ;
$context = stream_context_create(array('http' => $http_request));
$file = @file_get_contents($server_url, false, $context);
if ($file==false) {
#handle error here...
display_mssg("error","! we get a pb !");
}
$response = xmlrpc_decode($file);
if (is_array($response) and xmlrpc_is_fault($response)){
display_mssg("error","Failed to ping ".$site_name);
}
else {
display_mssg("success","Successfully pinged ".$site_name);
var_dump($response);
var_dump($file);
}
それは「成功」状態に入るとことを私が表示され、なぜ私が理解することはできません。あなたのためのおかげで助け
! we get a pb !
Successfully pinged Technorati
null
boolean false
。 ローカルWAMPサーバー上でXML-RPC PHPエクステンションが有効になっていることに注意してください。
'@'を削除し、取得したエラーメッセージを調べます。それはあなたを助けるはずです。 http://php.net/error-reportingも参照してください – hakre