该系统在内网。。
我写的程序代码如下:<?php
function rpc_client_call($host, $port, $rpc_server, $request) { //打开指定的服务器端
$fp = fsockopen($host, $port);
//构造需要进行通信的XML-RPC服务器端的查询POST请求信息
$query = "POST $rpc_server HTTP/1.0\nUser_Agent: XML-RPC Client\nHost:
".$host."\nContent-Type: text/xml\nContent-Length: ".strlen($request)."\n\n".$request."\n"; //把构造好的HTTP协议发送给服务器,失败返回false
if (!fputs($fp, $query, strlen($query)))
{
$errstr = "Write error";
return false;
} //获取从服务器端返回的所有信息,包括HTTP头和XML信息
$contents = "";
while (!feof($fp))
{
$contents .= fgets($fp);
} //关闭连接资源后返回获取的内容
fclose($fp);
return $contents;
} //构造连接RPC服务器端的信息
$host = "134.128.186.146";
$port = "7001";
$rpc_server = "/salemgr/services/mypros";
//把需要发送的XML请求进行编码成XML,需要调用的方法是rpc_server,参数是get
$request = xmlrpc_encode_request("MyProsServer", "GetPorsInfo"); //调用rpc_client_call函数把所有请求发送给XML-RPC服务器端后获取信息
$response = rpc_client_call($host, $port, $rpc_server, $request);
echo $request;
//分析从服务器端返回的XML,去掉HTTP头信息,并且把XML转为PHP能识别的字符串
$split = "";
//$xml = explode($split, $response);
//$xml = $split . array_pop($xml);
//$response = xmlrpc_decode($responses);//输出从RPC服务器端获取的信息
print_r($response);?>
可是取不到数据,各位大大帮忙看下是什么问题。。
我写的程序代码如下:<?php
function rpc_client_call($host, $port, $rpc_server, $request) { //打开指定的服务器端
$fp = fsockopen($host, $port);
//构造需要进行通信的XML-RPC服务器端的查询POST请求信息
$query = "POST $rpc_server HTTP/1.0\nUser_Agent: XML-RPC Client\nHost:
".$host."\nContent-Type: text/xml\nContent-Length: ".strlen($request)."\n\n".$request."\n"; //把构造好的HTTP协议发送给服务器,失败返回false
if (!fputs($fp, $query, strlen($query)))
{
$errstr = "Write error";
return false;
} //获取从服务器端返回的所有信息,包括HTTP头和XML信息
$contents = "";
while (!feof($fp))
{
$contents .= fgets($fp);
} //关闭连接资源后返回获取的内容
fclose($fp);
return $contents;
} //构造连接RPC服务器端的信息
$host = "134.128.186.146";
$port = "7001";
$rpc_server = "/salemgr/services/mypros";
//把需要发送的XML请求进行编码成XML,需要调用的方法是rpc_server,参数是get
$request = xmlrpc_encode_request("MyProsServer", "GetPorsInfo"); //调用rpc_client_call函数把所有请求发送给XML-RPC服务器端后获取信息
$response = rpc_client_call($host, $port, $rpc_server, $request);
echo $request;
//分析从服务器端返回的XML,去掉HTTP头信息,并且把XML转为PHP能识别的字符串
$split = "";
//$xml = explode($split, $response);
//$xml = $split . array_pop($xml);
//$response = xmlrpc_decode($responses);//输出从RPC服务器端获取的信息
print_r($response);?>
可是取不到数据,各位大大帮忙看下是什么问题。。
解决方案 »
- 进来讨论一下ajax,三层和mvc
- 高薪诚心寻求捷报网吧乐园的开发人员,有意的请速联系!
- xmlrpc中文乱码
- [请教]php怎样执行exe文件。
- 这个php签到源码,我如果想把两个帐号固定内置在代码里,要怎么写呢? @sibang大侠 谢谢!
- 【100分】怎么解决linux下面流媒体的盗链问题
- 求读取https页面内容的办法!
- 初学者,请大家帮帮忙:请问在PHP里怎样捕获用户退出登录这一事件(当然不是指按退出登录按钮,而是比方说与本网站相关的网页全部关闭或
- 100寻找php+sql server2000论坛
- eclipse for php中,变量没有定义,如何提示一个像波浪线的东西出来
- [MYSQL问题]当SUM()遇到WHERE的时候
- 一个有挑战的数组问题
顶一个。。