一、接收xml数据, 使用php://input,代码如下:

    <?php
$xmldata=file_get_contents("php://input");
$data=simplexml_load_string($xmldata);
print_r($data);
?>

二、使用CURL发送xml数据,代码如下:

    <?php
$xml = file_get_contents('1.xml');
$url = "http://test.xxx.com/xxx.php";
$header[]="Content-type: text/xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//被弃用了
$res = curl_exec($ch);
curl_close($ch); ?>

转:https://blog.csdn.net/wclovesjl/article/details/10348727

最新文章

  1. MySQL数据库备份--mysqldump用法
  2. 菜鸟学Windows Phone 8开发(3)——布局和事件基础
  3. 对于Maven管理的项目制定虚拟目录
  4. PHP编译安装出错configure: error: mcrypt.h not found. Please reinstall libmcrypt的解决办法
  5. Android 模仿QQ空间风格的 UI(转)
  6. C#编码标准--编码习惯
  7. cocos2d-x游戏开发系列教程-坦克大战游戏之敌方坦克AI的编写
  8. 脱壳第二讲,手动脱壳PECompact 2.x
  9. HTTPS加密原理
  10. 查找运行时间超过1天的frmweb进程
  11. C++设计实现一个不能被继承的类
  12. LeetCode: String to Integer (atoi) 解题报告
  13. PostgreSQL ALTER TABLE中改变数据类型时USING的用法&lt;转&gt;
  14. MySQL Disk--NAND Flash原理
  15. PHP简单工厂模式、工厂方法模式和抽象工厂模式
  16. And Design:拓荒笔记——Form表单
  17. spring中的default-lazy-init参数和lazy-init
  18. python基础----多态与多态性、super函数用法、继承原理
  19. coding.net--多人合作开发git的使用
  20. 统计tophat map上的read数量

热门文章

  1. 大数据技术之_16_Scala学习_08_数据结构(下)-集合操作+模式匹配
  2. 「kuangbin带你飞」专题十五 数位DP
  3. 「JXOI2018」游戏
  4. SPOJ705 SUBST1 - New Distinct Substrings(后缀数组)
  5. 学习Flash 3D图形图像知识的网络资源集合
  6. Bean的实例化--构造器
  7. 集合框架(高级for的使用)
  8. WEB安全漏洞与防范
  9. Linux Shell常用技巧
  10. iptables 的学习资源