2010-07-01 92 views

回答

4

我用「fopen」,它的工作原理。

//You can use 'POST','GET','PUT' or 'DELETE' 
$opts = array(
    'http'=>array(
     'method'=>'POST', 
     'header'=>"Content-Type: text/xml\r\n" . 
      $auth."\r\n", 
     'content'=>$xml 
    ) 
); 

$context = stream_context_create($opts); 

/* Sends an http request to www.example.com 
with additional headers shown above */ 
$fp = fopen($url, 'r', false, $context); 
fpassthru($fp); 
fclose($fp);
+0

忽略該行$驗證「\ r \ n」個 我使用它的基本身份驗證,但它沒有必要作其他用途。 – 2010-07-06 18:02:41

0

curl

這可以用於精細設置幾個頭 - POSTPUTDELETE - 爲你休息的請求,以及發送有效載荷 - 你的XML內容。