How to isolate the contents of an xml tag after a soap request











up vote
0
down vote

favorite
1












I just created a soap request using curl and I'm trying to isolate the content of an xml tag in order to use it in another soap request.



Here is my code :



$xml_data = '<soapenv:Envelope xmlns:ns1="qsfd" xmlns:ns2="qsdf" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">




  <ns2:GetStock>

<ns2:request>

<ns1:StockRequests>

<ns1:StockRequest>

<ns1:CustomerNo>qsf</ns1:CustomerNo>

<ns1:Division>qsdf</ns1:Division>

<ns1:Item>qsdf</ns1:Item>

</ns1:StockRequest>

</ns1:StockRequests>

</ns2:request>

</ns2:GetStock>






$URL = "qsdf";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'SOAPAction:qsdf'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo htmlentities($output);
die();









share|improve this question







New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
    – Philipp Palmtag
    2 days ago










  • In the xml answer I get, there is a tag <a:stock> that I want to use.
    – John Doe1245
    yesterday










  • I see please post the answer from the XML too.
    – Philipp Palmtag
    yesterday















up vote
0
down vote

favorite
1












I just created a soap request using curl and I'm trying to isolate the content of an xml tag in order to use it in another soap request.



Here is my code :



$xml_data = '<soapenv:Envelope xmlns:ns1="qsfd" xmlns:ns2="qsdf" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">




  <ns2:GetStock>

<ns2:request>

<ns1:StockRequests>

<ns1:StockRequest>

<ns1:CustomerNo>qsf</ns1:CustomerNo>

<ns1:Division>qsdf</ns1:Division>

<ns1:Item>qsdf</ns1:Item>

</ns1:StockRequest>

</ns1:StockRequests>

</ns2:request>

</ns2:GetStock>






$URL = "qsdf";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'SOAPAction:qsdf'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo htmlentities($output);
die();









share|improve this question







New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
    – Philipp Palmtag
    2 days ago










  • In the xml answer I get, there is a tag <a:stock> that I want to use.
    – John Doe1245
    yesterday










  • I see please post the answer from the XML too.
    – Philipp Palmtag
    yesterday













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I just created a soap request using curl and I'm trying to isolate the content of an xml tag in order to use it in another soap request.



Here is my code :



$xml_data = '<soapenv:Envelope xmlns:ns1="qsfd" xmlns:ns2="qsdf" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">




  <ns2:GetStock>

<ns2:request>

<ns1:StockRequests>

<ns1:StockRequest>

<ns1:CustomerNo>qsf</ns1:CustomerNo>

<ns1:Division>qsdf</ns1:Division>

<ns1:Item>qsdf</ns1:Item>

</ns1:StockRequest>

</ns1:StockRequests>

</ns2:request>

</ns2:GetStock>






$URL = "qsdf";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'SOAPAction:qsdf'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo htmlentities($output);
die();









share|improve this question







New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I just created a soap request using curl and I'm trying to isolate the content of an xml tag in order to use it in another soap request.



Here is my code :



$xml_data = '<soapenv:Envelope xmlns:ns1="qsfd" xmlns:ns2="qsdf" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">




  <ns2:GetStock>

<ns2:request>

<ns1:StockRequests>

<ns1:StockRequest>

<ns1:CustomerNo>qsf</ns1:CustomerNo>

<ns1:Division>qsdf</ns1:Division>

<ns1:Item>qsdf</ns1:Item>

</ns1:StockRequest>

</ns1:StockRequests>

</ns2:request>

</ns2:GetStock>






$URL = "qsdf";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'SOAPAction:qsdf'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo htmlentities($output);
die();






php xml curl soap






share|improve this question







New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









John Doe1245

12




12




New contributor




John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






John Doe1245 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
    – Philipp Palmtag
    2 days ago










  • In the xml answer I get, there is a tag <a:stock> that I want to use.
    – John Doe1245
    yesterday










  • I see please post the answer from the XML too.
    – Philipp Palmtag
    yesterday


















  • I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
    – Philipp Palmtag
    2 days ago










  • In the xml answer I get, there is a tag <a:stock> that I want to use.
    – John Doe1245
    yesterday










  • I see please post the answer from the XML too.
    – Philipp Palmtag
    yesterday
















I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
– Philipp Palmtag
2 days ago




I am not sure if I understand your question. Please clarify which content you want to get. If you want to parse XML you can user SimpleXML and (if the structure is more complex) XPath to get your desired content.
– Philipp Palmtag
2 days ago












In the xml answer I get, there is a tag <a:stock> that I want to use.
– John Doe1245
yesterday




In the xml answer I get, there is a tag <a:stock> that I want to use.
– John Doe1245
yesterday












I see please post the answer from the XML too.
– Philipp Palmtag
yesterday




I see please post the answer from the XML too.
– Philipp Palmtag
yesterday

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






John Doe1245 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373406%2fhow-to-isolate-the-contents-of-an-xml-tag-after-a-soap-request%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








John Doe1245 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















John Doe1245 is a new contributor. Be nice, and check out our Code of Conduct.













John Doe1245 is a new contributor. Be nice, and check out our Code of Conduct.












John Doe1245 is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373406%2fhow-to-isolate-the-contents-of-an-xml-tag-after-a-soap-request%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith