Hey guys,
I’m having trouble trying to make a script that gets the source code of a website in a different domain. I tried two requests, one with ajax and one with CORS, both found online with a little search. But none of them are working because the server I’m trying to access doesn’t allow it. It also doesn’t have an API
Ajax:
$.ajax({
url: 'http://www.cresesb.cepel.br/index.php?section=sundata',
success: function(data) {
console.log(data);
}
});
I get the following error:
XMLHttpRequest cannot load http://www.cresesb.cepel.br/index.php?section=sundata. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.
So, since I have no way of putting that header on the resource server, I can’t get any data by this method?
Is there a different way of doing this?
p.s: There is an API about solar radiation, but they only have data for the US, and all the coordinates I need to consult are in south america. Solar Resource Data API | NREL: Developer Network . If anyone knows a good and free one that also has info for different countries it would be great!