文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>php fsockopen post数据发送实例

php fsockopen post数据发送实例

时间:2010-12-23  来源:秩名

function do_call($host,$port,$request) //定义函数
{
$fp=fsockopen($host,$port,$errno,$errstr);
$query="post /default/php教程/server.php http/1.0nuser_agent:this is a dummy clientnhost:".
$host."ncontent-type:text/xmlncontent-length:".
strlen($request)."nn".$request."n";
if(!fputs($fp,$query,strlen($query)))
{
$errstr="write error";
return 0;
}
$contents='';
while(!feof($fp))
{
$contents.=fgets($fp);
}
fclose($fp);
return $contents;
}
$host='localhost'; //定义host地址
$port=80; //定义端口
$obj->type="datetime"; //定义对象
$obj->scalar="20040420t13:32:40";
$obj->timestamp=1082460760;
$request=xmlrpc_encode_request('dummyserver',$obj); //为php生成xml
$response=do_call($host,$port,$request); //调用函数
$xmlrpctype=xmlrpc_get_type($response); //获取xmlrpc类型
print_r($xmlrpctype); //输出结果?>
 

标签分类: PHP

相关阅读 更多 +
排行榜 更多 +
我的武侠梦手游下载

我的武侠梦手游下载

角色扮演 下载
快乐连连看下载免费版

快乐连连看下载免费版

休闲益智 下载
泛滥死者布道手机版下载

泛滥死者布道手机版下载

角色扮演 下载