<?php
function ping($host, $action=false){
$http=@fsockopen($host, 80, $errno, $errstr, 1);
if($http){
fwrite($http, "GET /".$action." HTTP/1.0\r\nAccept: */*\r\nHost: ".$host."\r\n\r\n");
fclose($http);
return true;
}else{
return false;
}
}
$host=$_SERVER[HTTP_HOST];
$id=uniqid();
//write a query
file_put_contents('./id/'.$id, json_encode($_GET));
file_put_contents('./taskss.list', $id."\n", LOCK_EX');
//watchdog for daemon
$f=fopen('./daemon.active');
flock($f, LOCK_SH);
// timeout 3 min
if((file_get_contents($f)+3)<date('Ymdhi')){
ping('http://'.$host.'/daemon.php');
sleep(1);
}
flock($f, LOCK_UN);
fclose($f);
//waiting for answer
while(true){
sleep(1);
$answer=file_get_contents('./answer/'.$id);
if($answer){
echo $answer;
break;
}
}
<?php
include('./phplot.php');
$csv='"Date";"Visitors";"Average duration (min)"
"Jul. 14";1.4;11.8
"Aug. 14";1.5;11
"Sep. 14";0.63;8.4
"Oct. 14";1.4;8.8
"Nov. 14";1.3;6.8
"Dec. 14";1.5;4.4
"Jan. 15";1.7;6.8
"Feb. 15";0.71;2.5
"Mar. 15";0.65;3
"Apr. 15";2.2;4.4
"May 15";0.032;0
"Jun. 15";0.47;11
"Jul. 15";5.7;10.6';
$graph =& new PHPlot(320,240);
$graph->SetTitle("Quantity");
$graph->SetXTitle('X data');
$graph->SetYTitle('Y data');
$data = str_getcsv($csv, ';', "\n");
$graph->SetDataValues($data);
$graph->DrawGraph();
?>
оказывается ничего он не ждет, а просто выдает ошибку