Jump to content

krygnc

New Members
  • Posts

    1
  • Joined

  • Last visited

krygnc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.