Ben bir API ve bu döngü ve çıkış kontrolleri gelen sonuçların 5 tekrarlamalar gereken bir sonucu olarak bağlıyorum.
The code
<?php
$i = 0;
$opts = array(
'https'=>array(
'method'=>"POST",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
$fp = fopen('https://ssl.theapidomain.com.au/check.php?domain=testdomain&suffixes=com.au', 'r', false, $context);
while ($i < 5) {
fpassthru($fp);
$out = explode('<br>', $fp);
echo $out[0];
echo "<br>";
echo $out[1];
echo "<br>";
echo date('H:i:s');
echo "<br>";
$i++;
}
fclose($fp);
?>
The output
available: testdomain.com.au not available: whoisfailure: Resource id # 2
16:58:57
Resource id # 2
16:58:57
Resource id # 2
16:58:57
Resource id # 2
16:58:57
Resource id # 2
16:58:57
Bu 5 kez çıkış olmalıdır:
available: testdomain.com.au not available: 16:58:57
Ben $ echo zaman [0] ve [2], bu (mevcut / mevcut değil) iç kaynak id ziyade bilgileri görüntüler görünüyor.