PHP主動傳送與被動接收xml資料

2021-06-21 04:25:25 字數 1932 閱讀 6821

php如何以post形式傳送xml資料,php如何接收xml檔案

傳送xml:

postxml.php

$xmldata= "

< xml >< /tousername >

< fromusername >< /fromusername >

< createtime >1366181013< /createtim e>

< msgtype >< /msgtype >

< content >< /content >

< msgid >5867702771251151243< /msgid >

< /xml >";

//第一種傳送方式,也是推薦的方式:

$url = '';  //接收xml資料的檔案

$header = "content-type: text/xml";  

//定義content-type為xml,注意是陣列

//第二種傳送方式:

$url = '

'; $header = "content-type: text/xml";//定義content-type為xml

接收xml:getxml.php

//將xml資料寫入文字檔案"a.txt"中

$handle  = fopen('a.txt','a+'); 

fwrite($handle,$xml);

問題:為什麼不使用$_post接收?

擴充套件閱讀:

使用php curl的post資料

php 傳送與接收流檔案

php 傳送與接收流檔案 sendstreamfile.php 把檔案以流的形式傳送 receivestreamfile.php 接收流檔案並儲存到本地 sendstreamfile.php php 傳送流檔案 param string url 接收的路徑 param string file 要傳送...

php 傳送與接收流檔案

php 傳送與接收流檔案 sendstreamfile.php 把檔案以流的形式傳送 receivestreamfile.php 接收流檔案並儲存到本地 sendstreamfile.php php view plain copy php 傳送流檔案 param string url 接收的路徑 p...

php 傳送與接收流檔案

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!php 傳送與接收流檔案 sendstreamfile.php 把檔案以流的形式傳送 receivestreamfile.php 接收流檔案並儲存到本地 sendstreamfile.php php 傳送流檔案 param string url 接...