max_execution_time = 900
<?php
$time_start = microtime(true);
$url = 'http://www.domain.com/testing/persistent/asyncUrl.php';
function makeAsyncCall($url, $params)
{
ini_set("default_socket_timeout", 10000);
$post_string = http_build_query($params);
$parts = parse_url($url);
$fp = pfsockopen($parts['host'],
isset($parts['port']) ? $parts['port'] : '80',
$errno, $errstr, 30); // Here 30 is The connection timeout, in seconds.
if(!$fp) {
//Perform a synchronous call when the fsockopen function not supported / return error by the server
echo "Error No: {$errno} <br/>";
echo "And Error Message is: {$errstr}";
} else {
# stream_set_timeout($fp, 2500, 1000);
$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 .= "Content-Length: " . strlen($post_string) . "\r\n";
# $out .= "Connection: Close\r\n";
$out .= "Connection: Keep-Alive\r\n";
$out .= "Keep-Alive: timeout=190, max=100\r\n";
$out .= "\r\n";
if (isset($post_string)) {
$out .= $post_string;
}
fwrite($fp, $out);
fclose($fp);
}
}
//Define the post variables that you want sent
$post_vars = array('customerId' => '36');
$asyncUrl = 'http://www.domain.com/testing/persistent/asyncUrl.php';
makeAsyncCall($asyncUrl, $post_vars);
$time_end = microtime(true);
echo '<b>Total Execution Time:</b> ' . ($time_end - $time_start) . ' Seconds';
?>
<?php
try {
$errorLog = time() . ".log";
set_time_limit(0);
ini_set('display_errors', '1');
error_reporting(E_ALL);
$timeStart = microtime(true);
$count = 0;
while($count < 300) {
sleep(1);
$count++;
$timeEnd = microtime(true);
$meesage = 'Total Execution Time - ' . $count. ': ' . ($timeEnd - $timeStart) . ' Seconds \n';
error_log($meesage, 3, $errorLog);
}
$timeEnd = microtime(true);
$meesage = 'Total Execution Time: ' . ($timeEnd - $timeStart) . ' Seconds \n';
error_log($meesage, 3, $errorLog);
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
error_log("Error: " .$e->getMessage(), 3, $errorLog);
}
?>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /testing/persistent/
RewriteRule .* - [E=noconntimeout:1]
RewriteRule .* - [E=noabort:1]
</IfModule>
<IfModule litespeed>
RewriteRule .* - [E=noabort:1]
</IfModule>