I use fopen to access and wirte on a json file my controller code is like this
$this->data['date'] = $this->issue_model->get_date();
$this->data['com'] = fopen("assets/global/plugins/fullcalendar/demos/json/events.json", "r") or die("Unable to open file!");
$txt = json_encode($this->data['date']);
fwrite($this->data['com'], $txt);
at the beginning i wrote the whole path but it give me an error
fopen(base_url().'assets/global/plugins/fullcalendar/demos/json/events.json', "r") or die("Unable to open file!");
the error look like this
A PHP Error was encountered
Severity: Warning
Message: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known
Filename: controllers/welcome.php
Line Number: 45
the problem is my website work just fine in my localhost but when i uploaded it on my server it don't access the file and write on it
can anybody tell me what is wrong with my code?