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 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧