Example.
Literally, I just needed to automate the work of the content manager of one of the sponsored sites. The necessary class was found quite quickly (post via XML-RPC), the necessary functionality was added. Verification (local) showed that everything works fine. But after installing on the server, it turned out that the class was written for PHP5 (on the server, one of the 4.4 branch). After a quick glance, it turned out that the problem was in a single function - file_get_contents, to which the ability to get a file using the POST method was added, for example.
In the case of the example above, I just got the desired function from the package, inserted it into the code and it all worked. 30 seconds instead of rewriting the miraculous code and debugging the resulting one.
require_once 'PHP / Compat.php';
PHP_Compat :: loadFunction ('file_get_contents');
require_once 'PHP / Compat / Function / file_put_contents.php';
Source: https://habr.com/ru/post/19725/
All Articles