+4 votes
201 views
Read XML from PHP - Utility in SEO and to share content

in SEO by (551k points)
reopened | 201 views

1 Answer

+5 votes
Best answer

The advantage of distributing content in XML is that other websites or systems can communicate and download or request information without having to access our database. We can also use it for Seo allowing other websites to publish information on our website.

Example linking an XML of Sports

We will take a feed from a newspaper that makes available a sports xml
http: //www.diariosur...ds/deportes.xml

The xml file has a structure that we can see if we copy your url in a browser and then we will see the source code or downloading and viewing it in some software that supports xml here use Netbeans to order it.

image


Then I will use a php function called simple_load_xml () to read the file externally, that is, from the journal server. It is important to note here that the other server must allow me to read remotely and I must have the function activated in my apache but it will not work.

We create a script that will read and process the XML file.


image


As a result of the process and listed in html we obtain


image


Then we can add css and design that we want, or save this information.

Also in the same way we can offer content via generating an XML as an RSS channel for other websites.

The interesting thing is that every time we update our xml it will automatically be updated in all the websites where it is shared, it can also be used for business applications where it is necessary to receive and generate distributed information that is easily updated, regardless of the system that performs the query, granting it a lot of flexibility to the user.

Using XML for Business

XML structures can also be used for commercial transactions such as Paypal, Sermepa, La Caixa and many others, such as the one used by BBVA for its payment gateway. Once the payment gateway is processed, an identification number of the trade is generated and from this we can connect with the POS ( terminal point of sale ), so that the users can make payments and we can receive data about the specific operations.


Here we create a PHP script with the xml that we generate to send to the POS from a web form with an order made by a user.


image


When we send the XML the POS processes it and responds with an xml, but via url so we must read the xml from a request parameter that the POS sends.


image


After reading the xml, very similar to how we did it at the beginning, we will determine the status of the payment, we will obtain status 2 if the payment was made, but we will obtain an error code and what is the cause to inform the client.
There are other utilities such as offering our customers a catalog of products that update prices or stock automatically from any device or platform, information available for different areas of a company, but distributing the information in XML without giving them access to the database.

by (3.5m points)
edited

Related questions

+3 votes
1 answer
asked Jun 24, 2019 in SEO by backtothefuture (551k points) | 342 views
+3 votes
1 answer
asked Jun 24, 2019 in SEO by backtothefuture (551k points) | 190 views
+5 votes
1 answer
asked Jun 23, 2019 in SEO by backtothefuture (551k points) | 264 views
+4 votes
1 answer
asked Apr 17, 2023 in SEO by backtothefuture (551k points) | 48 views
+5 votes
1 answer
asked Jun 24, 2019 in SEO by backtothefuture (551k points) | 176 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users