简体   繁体   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

Please help me in create soap request using PHP .请帮助我使用PHP创建 soap 请求。 I have to get stock and product details.我必须获取库存和产品详细信息。 using to soap API.使用 soap API。

No need to create soap client you can easily create an xml form and sent the request无需创建 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