I'm using the PHP Imap Library along with Ajax to display search results from within emails. The main problem I am finding is that providers (Hotmail in particular) will cut off connection after 6 or 7 connections in close proximity of time.
Instead of imap_connect() in each script, I'd like to connect once and then continuously display information with ajax. I just have no idea how to do this. The problem is that I need to spit out data through the ajax. Is there any way to return information without ending the PHP program through jquery?
I could also potentially do this if I pass the imap connection variable $connection to the php query instead of calling it, but unsure how to pass it. Here's how I'm currently passing the variables.
var dataString='email=<?php echo $email_address; ?>&connection=<?php echo $connection; ?>&password=<?php echo $password; ?>&server=<?php echo $server;?>&daysago='+daysago+'&num='+num;
$.ajax({
type: "POST",
url: "fastsearch.php",
data: dataString,
success: function(msg){
Link to Imap Connect (and general php imap library): http://php.net/manual/en/function.imap-open.php