Most API's don't allow you to connect them from the client side.
You first should fetch the data from the Coindesk API on the server side and then publish them on your own API or push them on to a view.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey, i am getting the following errors when i try to use an api with axios:
Access to XMLHttpRequest at 'https://api.coindesk.com/v1/bpi/currentprice.json' from origin 'http://cryptogains.test' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Uncaught (in promise) Error: Network Error
at createError (app.js:13874)
at XMLHttpRequest.handleError (app.js:13758)
I already installed barryvdh package and registered it in the kernel.php file on middleware and the api group routes, but the error persisted. Any idea how i can fix this without using an external chrome extension.
Please or to participate in this conversation.