i searched for a solution to make an asynchronous page request and found these lines of codes. (actually i editted a little bit)
function do_the_thing()
{
$parts = parse_url("mail_sender.php");
$fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80,
$errno, $errstr, 30);
$out = "POST " . $parts['path'] . " HTTP/1.1\r\n";
$out.= "Host: " . $parts['host'] . "\r\n";
$out.= "Content-Type: application/x-www-form-urlencoded\r\n";
$out.= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
fclose($fp);
}
so i have a mail_sender.php that sends an e-mail AUTOMATICALLY but with this asynchronous call, it doesn’t send anything. Am i missing somthing here? I am calling function in another page so page load continues without waiting the mail sending process. Only problem is, i seem to be unable to request the page or page is requested but doesn’t do the job.
Just looking at the first two lines of your function, you have a problem:
parse_url("mail_sender.php")gives you an array with one element (see example):So you are calling
fsockopenwithout the first – required – parameter.