[英]Newbee to soap , I want to request to soap api, do i need to create soap client using php
請幫助我使用PHP創建 soap 請求。 我必須獲取庫存和產品詳細信息。 使用 soap API。
無需創建 soap 客戶端,您可以輕松創建 xml 表單並發送請求
function SendRequest($url,$data){
global $curl; //initiate curl
$curl->setHeader('Content-Type','text/xml');
$xml = new DOMDocument( '1.0', 'UTF-8');
$ocs_request=$xml->createElement("ocsRequest");
foreach($data As $key=>$value){
${$key} = $xml->createElement($key,$value);
$ocs_request->appendChild(${$key});
}
$xml->appendChild($ocs_request);
$xml = $xml->saveXML();
$post = $curl->post($url,$xml); //you can change post, get depending on your request type
return $post;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.