Phpfsockopen concurrency: fsockopen concurrency. I want to send an email without knowing how to send an email to fsockopen. you can use ajax to send the email cyclically, or use the following two methods (the Western code is the general idea ): PHPcodeif (isset ($ _ GET ['php fsockopen concurrency
Ask for fsockopen concurrency.
I want to send an email. I don't know how to send an email to fsockopen.
------ Solution --------------------
You can use ajax to send emails cyclically, or use the following two methods (the Western code is the general idea ):
PHP code
If (isset ($ _ GET ['AC']) & $ _ GET ['AC'] = 'sendmail') {sendEmail (); // send email operation} function fSockGet ($ url, $ timeout = 3) {$ info = parse_url ($ url); extract ($ info ); $ query = isset ($ query )? Trim ($ query): ''; $ path = isset ($ path )? Trim ($ path): ''; $ fp = fsockopen ($ host, 80, $ errno, $ errstr, $ timeout); if (! $ Fp) {exit ("$ errstr ($ errno)
\ N ") ;}$ write = fwrite ($ fp," GET {$ path }? {$ Query} HTTP/1.0 \ r \ nHost: {$ host} \ r \ n "); // while (! Feof ($ fp) {// echo fread ($ fp, 4096); //} $ url = "http://mydir.com/index.php? Act = sendMail "; $ emailList = array (...); foreach ($ emailList as $ email) {fSockGet ($ url );}