Migrated from fsockopen() to socket_*()

Closed connection handling in fsockopen() is a bit picky..
When using socket_* in php, the socket_read() returns false when the
socket is closed..