How to override php.ini timeout for imap_timeout functions with secure POP3 servers

The PHP IMAP library has no built-in ways to modify the imap_timeout function for secure pop3 connections. I am looking to create this function, so I can set the timeout to 1 second for connections for secure pop3 servers, but I'm just not sure where I will start learning about overriding the php.ini command in the PHP function. Any ideas?

imap_timeout (1,) works fine for pop3 connections , but apparently not for pop3s (ssl, port 995) connections, where the default socket timeout is still applied. This applies to php 4.3.10, not tested on other versions.


We studied the source to find out what this function really does and how to use it. The function overrides the default_socket_timeout parameter from the php.ini file

You can get the current timeout length for each timeout by calling a function like:

imap_timeout (timeout_type); or imap_timeout (timeout_type, -1);

You can set the timeout length for any type of timeout by setting the timeout for a few seconds.

imap_timeout (timeout_type,);

The timeout types are as follows:

1: Open 2: Read 3: Write 4: Close

It doesn't look like the closure type has been implemented.

Source: https://students.kiv.zcu.cz/doc/php5/manual/cs/function.imap-timeout.php.html

+7
source share
1 answer

use default_socket_timeout

here's a little demo to override the default configuration.

 ini_set('default_socket_timeout', 2); // your socket based code here // restore to the default socket timeout ini_restore('default_socket_timeout'); 
+5
source

All Articles