繁体   English   中英

Newbee to soap, I want to request to soap api, do i need to create soap client using php

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM