Along with the issues/recommendations Bertrand exposed in his vote, I would also like to add:
- getOS is defined twice
- a lot of file operations without any error handling (fopen, opendir, etc)
- not entirely sure why you need to call an external api call in this particular case, but since you have it there, file_get_contents is #1 blocking and #2 it emits and E_WARNING.
As a side note, when you link to github, redirect me there and do not ask for my e-mail.