Friday, April 14, 2023

Pc

Price Comparison Website loadHTML($html); $xpath = new DOMXpath($doc); $price = $xpath->query($xpath)->item(0)->nodeValue; return $price; } // fetch prices from Swiggy $swiggy_url = "https://www.swiggy.com/"; $swiggy_xpath = "//span[@class='MuiTypography-root jss394 MuiTypography-body1 MuiTypography-colorTextSecondary']"; $swiggy_price = fetchPrice($swiggy_url, $swiggy_xpath); // fetch prices from Zomato $zomato_url = "https://www.zomato.com/"; $zomato_xpath = "//div[@class='sc-1pz8vnu-0 jfFHQH']"; $zomato_price = fetchPrice($zomato_url, $zomato_xpath); // fetch prices from Uber Eats $uber_eats_url = "https://www.ubereats.com/"; $uber_eats_xpath = "//span[@class='sc-cbVVcV bdrRrt']"; $uber_eats_price = fetchPrice($uber_eats_url, $uber_eats_xpath); // display prices echo "

Prices:

"; echo "
    "; echo "
  • Swiggy: " . $swiggy_price . "
  • "; echo "
  • Zomato: " . $zomato_price . "
  • "; echo "
  • Uber Eats: " . $uber_eats_price . "
  • "; echo "
"; // compare prices if ($swiggy_price < $zomato_price && $swiggy_price < $uber_eats_price) { echo "

Swiggy is the cheapest option.

"; } elseif ($zomato_price < $swiggy_price && $zomato_price < $uber_eats_price) { echo "

Zomato is the cheapest option.

"; } elseif ($uber_eats_price < $swiggy_price && $uber_eats_price < $zomato_price) { echo "

Uber Eats is the cheapest option.

"; } else { echo "

No clear winner.

"; } ?>

No comments:

Post a Comment

highrevenuegate.com/60ad5ff38996ce33b1ea374cdb6f6843/invoke.jshighrevenuegate.com/60ad5ff38996ce33b1ea374cdb6f6843/invoke.js