I have this php code:
<?php
if(isset($_POST['gen'])){
$genapi = "http://domain.com/api.php";
$result5 = htmlentities(file_get_contents($genapi));
list($first, $last) = explode(':', $result5);
header('Location: minecraft.php?line='.$result5);
}
?>
I am having trouble making it so if "$result5" returns with "no" then to wait 2 seconds then try again but if "$result5" does NOT return with "no" it will run the header line.
if(isset($_POST['gen'])){
$loop = true;
while($loop){
$genapi = "http://domain.com/api.php";
$result5 = htmlentities(file_get_contents($genapi));
if($result5 !== 'no'){ // check your $result5 based on the value it returns
$loop = false;
list($first, $last) = explode(':', $result5);
header('Location: minecraft.php?line='.$result5);
}
else{
sleep(2);
}
}
}