I use the SplFileObject
class to work with files. The same does not occur with the sockets, when necessary to connect, being necessary to use the function fsockopen
or stream_socket_client
.
I need a code snippet in case a fwrite
can not write the data, throw an exception.
Is there any way to do this?