国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php 接收與發送xml文件

2024-05-04 21:58:40
字體:
來源:轉載
供稿:網友
  1. //接收xml: 
  2. $xml = file_get_contents('php://input'); 
  3.   
  4. //發送(post): 
  5. $xml_data = <xml>...</xml>"; 
  6. $url = http://dest_url; 
  7. $header[] = "Content-type: text/xml";//定義content-type為xml 
  8. curl_setopt($ch, CURLOPT_URL, $url); 
  9. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  10. curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
  11. curl_setopt($ch, CURLOPT_POST, 1); 
  12. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); 
  13. $response = curl_exec($ch); 
  14. if(curl_errno($ch)) 
  15.     print curl_error($ch); 
  16. curl_close($ch);  
  17.  //開源代碼Vevb.com 
  18. //或者: 
  19. $fp = fsockopen($server, 80); 
  20. fputs($fp"POST $path HTTP/1.0rn"); 
  21. fputs($fp"Host: $serverrn"); 
  22. fputs($fp"Content-Type: text/xmlrn"); 
  23. fputs($fp"Content-Length: $contentLengthrn"); 
  24. fputs($fp"Connection: closern"); 
  25. fputs($fp"rn"); // all headers sent 
  26. fputs($fp$xml_data); 
  27. $result = ''
  28. while (!feof($fp)) { 
  29. $result .= fgets($fp, 128); 
  30. return $result

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄢陵县| 怀宁县| 玛多县| 牙克石市| 永泰县| 凤庆县| 东港市| 华坪县| 松原市| 延吉市| 德州市| 浙江省| 阿拉善右旗| 彰武县| 肃北| 桐梓县| 淮滨县| 邯郸市| 区。| 将乐县| 盐津县| 家居| 子洲县| 海安县| 安康市| 昌宁县| 阿克苏市| 望谟县| 新绛县| 乌拉特中旗| 长武县| 皋兰县| 汉寿县| 兴业县| 沙坪坝区| 阳谷县| 德昌县| 循化| 夹江县| 秭归县| 古浪县|