最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php fsockopen post数据发送实例
时间:2022-06-24 20:11:18 编辑:袖梨 来源:一聚教程网
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); //输出结果?>
相关文章
- 百炼英雄怎么挂机 挂机方式及各等级最优点位攻略 12-15
- 百炼英雄vip礼包码大全 最新可用vip礼包码 12-15
- 光与影33号远征队符文收集:强力复生符文效果及获取方式详解 12-15
- 百炼英雄兑换码有哪些 最新可用兑换码及兑换方式 12-15
- 神器传说怎么克制闪避流 闪避流克制阵容实战攻略 12-15
- 神器传说怎么打异兽分最高 异兽冲榜高分搭配 12-15