<?php

require 'browserhawk.php';

  // This sample is provided under the terms of the BrowserHawk End User
  // License Agreement. Copyright (c) 2003-2011 cyScape, Inc. All rights
  // reserved.

  // This sample demonstrates how to detect whether a vistor is on a 
  // broadband connection.

  // Although we have made this sample very verbose with comments for
  // educational purposes, note that it takes only a few lines of code to
  // detect the Broadband property -  1) the creation of the ExtendedOptions
  // class, 2) using ExtendedOptions to set testing preferences and options,
  // and 3) calling to getExtendedBrowserInfo() to obtain an
  // ExtendedBrowserInfo instance where the answer can be obtained via its 
  // Broadband property.

  // First we create the ExtendedOptions object.  This object is used to set
  // various preferences and options, such as which extended properties we
  // want tested and related testing parameters.
  // NOT CREATED

  // Now we tell BrowserHawk we want to test for Broandband.  If there are
  // other settings you want to check as well, such as disabled
  // cookies/JavaScript, plugins, etc, you can do so concurrently with the
  // Broadband detection by adding the appropriate values to the statement
  // below.  See the ExtendedOptions class in the BrowserHawk documentation
  // for more information.
  $options->addProperties("Broadband");

  // OK, let's perform the check for Broadband. See the ExtendedOptions
  // class in the documentation for details on options available such as
  // controlling the background color of the screen and page messages i.e.
  // "Checking your browser. Please wait...". TIP: Set the BGCOLOR parameter
  // below to your site's background color. Otherwise you may notice a color
  // flicker during the test.
  $options->setPageMessage("BrowserHawk is checking your connection. Please wait...");
  $options->setBodyTag("BGCOLOR=#FFFFFF");
  $options->setPageTitle("Please wait...");

  // To avoid an ugly exception, we check that the system executing this
  // example has a Professional or Enterprise Edition license as required
  // for this test.
  // Note: This is NOT needed in your pages, only for this generic sample.
  if (strpos($BrowserHawk->getVersion(), "Pro") === false &&
      strpos($BrowserHawk->getVersion(), "Ent") === false) {
    echo "Professional or Enterprise License Required.  ";
    echo "You are using " . $BrowserHawk->getVersion() . ".  ";
    echo "See <a href='http://www.cyscape.com/order/'>http://www.cyscape.com/order/</a> for upgrade information.";
    return;
  }

  $einfo = bhextended($options);
?>





<html><head><title>BrowserHawk Sample - Broadband Detection</title></head>
<body><font face="arial">
<blockquote>
<h2>BrowserHawk Broadband Detection Demo</h2>
<font size=3>
<b>Test results:  Broadband connection? <?php boolprint($einfo->getBroadband()) ?></b>

<P>
<b><a href="broadband.php">Retry this test</a></b><P>
<b><a href="index.html">Return to list of other PHP samples</a></b><P>
<b><a href="http://www.cyscape.com/order/">BrowserHawk Pricing and Ordering</a></b><P>
<b><a href="http://www.cyscape.com/">cyScape home page</a></b><P>
</font></blockquote>
</body>
</html>
