欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php获取通过http协议post过来的xml数据

程序员文章站 2022-04-14 22:22:14
...
  1. $xml_data =''.
  2. ''.
  3. '1234567890'.
  4. 'lgsoftwares'.
  5. 'mypassword'.
  6. 'phpmind.com'.
  7. '
  8. '.
  9. ''.
  10. ''.
  11. ''.
  12. '
  13. '.
  14. ''.
  15. 'JHM'.
  16. 'OGGSHE'.
  17. '101009'.
  18. '101509'.
  19. '1'.
  20. '
  21. '.
  22. '
  23. ';
  24. $URL = "https://www.abc.com/path/";
  25. $ch = curl_init($URL);
  26. curl_setopt($ch, CURLOPT_MUTE, 1);
  27. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  28. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  29. curl_setopt($ch, CURLOPT_POST, 1);
  30. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  31. curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
  32. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  33. $output = curl_exec($ch);
  34. curl_close($ch);
  35. ?>
复制代码