[PHP] Detect timeout of stream_socket_client using STREAM_CLIENT_ASYNC_CONNECT ?

2010-11-06 Thread Craig Mason

(apologies if this sends twice - email verification issues)

Is it possible to detect the timeout of a stream created with 
stream_socket_client() using the flag 'STREAM_CLIENT_ASYNC_CONNECT' ?


As soon as this flag is used, it seems there is no way to detect a 
timeout situation.


tcp://192.168.100.100:123 is a fictional, non-existent endpoint.


Code:
===

$conn = stream_socket_client('tcp://192.168.100.100:123', $errNo, 
$errStr, 1, $flags);

stream_set_timeout($conn, 1);

$read = array($conn);
$write = array($conn);
$e = null;
stream_select($read, $write, $e, 5, 0);

var_dump($read);
var_dump($write);
var_dump($errNo);
var_dump($errStr);
var_dump(stream_get_meta_data($conn));



Output:
===

array(0) {
}
array(0) {
}
int(0)
string(0) ""
array(7) {
  ["stream_type"]=>
  string(14) "tcp_socket/ssl"
  ["mode"]=>
  string(2) "r+"
  ["unread_bytes"]=>
  int(0)
  ["seekable"]=>
  bool(false)
  ["timed_out"]=>
  bool(false)
  ["blocked"]=>
  bool(true)
  ["eof"]=>
  bool(false)
}

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP importing CVS data with field mapping

2010-11-06 Thread Don Wieland

Hi gang,

I have a need to to allow users to import into my web app via PHP. Is  
there any functions or javascripts out there will allow user to pick a  
cvs file, bring up a file mapping UI, then process data based on  
mapping and insert into mySQL DB.


Any help or resources would be appreciated.

Don

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php