S
S
siroper2020-08-07 20:03:19
PHP
siroper, 2020-08-07 20:03:19

How to read/parse xml response from api?

Hello. After a CURL request, an xml response is returned to CDEC, but the problem is that it is not displayed in the browser. print_r($result)
However, if you open the browser console, there is an answer. How to get and use it in PHP?
5f2d8952c849f627762649.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nokimaro, 2020-08-07
@nokimaro

https://www.php.net/manual/ru/simplexml.examples-b...
if you want to view it in the browser (it's not clear why), then run the string through htmlspecialchars

<?php
echo htmlspecialchars($result);

D
Developer, 2020-08-07
@samodum

What does "not displayed in the browser" mean? The screenshot clearly shows what is output.
It just removes the tags.
The response from the api is correct. Take it and use it. Though in PHP, even as a damn bald man

J
JhaoDa, 2020-08-07
@JhaoDa

https://github.com/sanmai/cdek-sdk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question