Fix typo in method name in example usage by michalkleiner · Pull Request #1935 · php/frankenphp
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, the file_put_contents function will not work as you expect because its signature differs from that of the file_get_contents. In addition, it is designed to write data to a file (not required in this case), and the HTTP wrapper only supports reading:
HTTP connections are read-only; writing data or copying files to an HTTP resource is not supported.
https://www.php.net/manual/en/wrappers.http.php
As a result, you will get an error:
Failed to open stream: HTTP wrapper does not support writeable connections
The correct solution: file_get_contents.