douhui9380 2016-12-29 07:31
浏览 64

使用PHP的XML请求/响应


I'm just doing a Front-End Dashboard for an ERP using PHP. Which is possible to integrate the ERP with XML Request and Response. The ERP URL would be something like http://localhost:9000.

To fetch the Data from that ERP, I must send the XML Request to the ERP server URL in a particular Template (These details are given in the ERP integration Manual)

XML Request Template:

<ENVELOPE>
<HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Data</TYPE>
    <ID>TrialBalance</ID>
</HEADER>

<BODY>
    <DESC>
        <STATICVARIABLES>
            <EXPLODEFLAG>Yes</EXPLODEFLAG>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
        </STATICVARIABLES>
    </DESC>
</BODY>
</ENVELOPE>

If I send this Request to the ERP server http://localhost:9000 It would give a response like below:

XML Response Template:

<ENVELOPE>
 <DSPACCNAME>
  <DSPDISPNAME>Purchase Accounts</DSPDISPNAME>
</DSPACCNAME>
 <DSPACCINFO>
  <DSPCLDRAMT>
   <DSPCLDRAMTA>-49566060.80</DSPCLDRAMTA>
</DSPCLDRAMT>
  <DSPCLCRAMT>
   <DSPCLCRAMTA></DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
</ENVELOPE>

Now I Have no idea how to send the XML request to an URL and Capture this Response using php.

I'm new to curl Where in curl I Know to send the Request but I have no idea how to receive this response store it and display it.
I'm sure if i capture this response and display it. I can parse the XML and get the values which I want from the ERP. I'm right now in the dark, can some one throw the light so that it could unlock my way to the next step.

Thanks in Advance!!!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog