Joomla模块开发 - 从存储在模块文件夹中的文件读取/处理JSON数据

I am in the process of developing a module that requires JSON data stored on a file within the folders of the module.

Initially I was using a link to the remote JSON file and that worked fine... until I realised that using this method doesn't work on certain servers configurations and causes issues with certain versions of jquery and IE.

The obvious solution to this issue is to read the file locally within the joomla module however I am getting 403 Forbidden errors on the php file that is serving the json data (see below).

The file with the JOSN data is a php file with this code:

$json = file_get_contents('https://www.googleapis.com/webfonts/....');
die($json);

I am calling the JSON file using jQuery:

$.getJSON('....', function (json) {....}

Would anybody know how to go around this issue? Thank you in advance for the help.

$json = file_get_contents(JPATH::base() . 'modules/my_module/myfilewithjson.php');
echo $json;
exit();

if the file is not local then you should be using curl to get the contents.