使用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!!!

dongpengqin3898
dongpengqin3898 让我清楚,我正在从我的PHP应用程序向我的ERP发送XML请求,这是一个能够获取XML请求和提供响应的桌面应用程序。现在我想使用我的PHP代码向http发送请求到http://localhost:9000,并且应该在我的PHP应用程序中查看ERP提供的响应。我知道如何请求,但没有想法查看响应。
接近 4 年之前 回复
dongxia2030
dongxia2030 我是否将XML发送到您的PHP应用程序或者您的PHP应用程序是从外部提取XML时感到困惑。
接近 4 年之前 回复
douyalin2258
douyalin2258 我可以使用curl将XML提供给URL,操作发生,问题是我不知道如何像上面所示将Raw捕获为RawXML。你能指导我使用哪种php功能吗?这样我就可以做研究了。
接近 4 年之前 回复
dsbckxk165039
dsbckxk165039 您可以使用CURL出去并使用PHP对数据进行FETCH。对SimpleXML和CURL做一点研究
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐