Hello, I am pulling data from a site
I want to give color according to the value that I want to do, is this possible?
I am doing it with the code below but the result is always green
$url = "simple";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
$dom = new DOMDocument();
@$dom->loadHTML($data);
$xpath = new DOMXPath($dom);
$statu1 = $xpath->query('//*[@id="page-wrapper"]/div/div[6]/div/h4[7]/span');
foreach ($statu1 as $status1)
if ($statu1 = "Online") {
echo "<font color = green>$status1->nodeValue</font><br>";
} elseif ($statu1 = "Offline") {
echo "<font color = red>$status1->nodeValue</font><br>";
}