Add support for running code from STDIN, improving compatibility

Fixes facebook/hhvm#1590
Implement correct behavior on stream connect and send/recv timeout

This PR fixes facebook/hhvm#1361, as reported on that issue:

- As document http://www.php.net/manual/zh/function.fsockopen.php
  says, timeout parameter to fsockopen() only applies while
  connecting the socket. , but hhvm use this parameter as socket
  send and recv timeout.

- In Zend php, stream_set_timeout set both send and recv timeout,
  while in hhvm it set only recv timeout.