M
M
Mixa2018-11-28 12:00:21
PHP
Mixa, 2018-11-28 12:00:21

Getting data from XML for dummies?

It would seem that the simplest task is to get a few numbers from an XML document on a third-party site, save it to a variable and display it in a widget on the site.

Started digging. I learned about xPath, but it turns out that they cannot process a document on a third-party server. The question is - how can you just parse XML data on a third-party site and drive it into PHP variables (Or JS variables, if you can work with XML in real time, without having to download the document to your server)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aleksey Solovyev, 2018-11-28
@Mixa

"they cannot process a document on a third-party server " What does this even mean?
What is the task?
Get file? jQuery.ajax() (vanilla XMLHttpRequest )
Parse a file? jQuery.parseXML() (vanilla your_parser)

L
leni_m, 2018-11-28
@leni_m

php:

$xml = @simplexml_load_file('http://ссылка_на_хмл.xml');
print_r($xml);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question