I need to retrieve data from an api but the data is only available in XML. I was told to retrieve the data to display it in HTML via this topic: How to retrieve values from xml file and display in html webpage?
Until I thought I was right, I changed the code with the info I needed and got the famous error in the Google Chrome console: (index):30 Access to XMLHttpRequest at 'xxx' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
So in my index.html file I added this PHP code at the beginning :
<?php header('Access-Control-Allow-Origin : *'); ?>
(I use the * for the tests only, to publish my code I will set the exact URL).
My page still shows this error, so I'm wondering if it's really on my code that I should put this, or on the recipient's server?