default
[ class tree: default ] [ index: default ] [ all elements ]

Source for file examples.guifi_api.misc.php

Documentation is available at examples.guifi_api.misc.php

  1. <?php
  2. // The source code packaged with this file is Free Software, Copyright (C) 2005 by
  3. // Eduard Duran <eduard.duran at iglu.cat>.
  4. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
  5. // You can get copies of the licenses here:
  6. //         http://www.affero.org/oagpl.html
  7. // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt".
  8.  
  9. require 'guifi_api.php' );
  10.  
  11. /**
  12.  * Configuration of authentication against guifi.net
  13.  */
  14. $username "";
  15. $password "";
  16.  
  17. /**
  18.  * Code from here!
  19.  */
  20. $gapi new guifiAPI$username$password );
  21.  
  22. $action $_GET['action'];
  23.  
  24. switch$action {
  25.     case 'model':
  26.         $model array();
  27.         $model['fid'8;
  28.         $model['supported''Yes';
  29.         
  30.         $models $gapi->getModels$model );
  31.         if$models {
  32.             echo '<ul>';
  33.             foreach$models as $model {
  34.                 echo '<li>';
  35.                 echo '<ul>';
  36.                 echo "<li>Model ID: $model->mid</li>";
  37.                 echo "<li>Manufacturer ID: $model->fid</li>";
  38.                 echo "<li>Model: $model->model</li>";
  39.                 echo "<li>Type: $model->type</li>";
  40.                 echo "<li>Supported: $model->supported</li>";
  41.                 echo '</ul>';
  42.                 echo '</li>';
  43.             }
  44.             echo '</ul>';
  45.         else {
  46.             echo "There was an error getting the models.<br />\n";
  47.             echo $gapi->getErrorsStr();
  48.         }
  49.         break;
  50.     case 'manufacturer':
  51.         $manufacturers $gapi->getManufacturers();
  52.         if$manufacturers {
  53.             echo '<ul>';
  54.             foreach$manufacturers as $manufacturer {
  55.                 echo '<li>';
  56.                 echo '<ul>';
  57.                 echo "<li>Manufacturer ID: $manufacturer->fid</li>";
  58.                 echo "<li>Name: $manufacturer->name</li>";
  59.                 echo "<li>URL: $manufacturer->url</li>";
  60.                 echo '</ul>';
  61.                 echo '</li>';
  62.             }
  63.             echo '</ul>';
  64.         else {
  65.             echo "There was an error getting the manufacturers.<br />\n";
  66.             echo $gapi->getErrorsStr();
  67.         }
  68.         break;
  69.     case 'firmware':
  70.         $firmware array();
  71.         $firmware['model_id'27// RB600
  72.         
  73.  
  74.         $firmwares $gapi->getFirmwares$firmware );
  75.         if$firmwares {
  76.             echo '<ul>';
  77.             foreach$firmwares as $firmware {
  78.                 echo '<li>';
  79.                 echo '<ul>';
  80.                 echo "<li>Title: $firmware->title</li>";
  81.                 echo "<li>Description: $firmware->description</li>";
  82.                 echo '</ul>';
  83.                 echo '</li>';
  84.             }
  85.             echo '</ul>';
  86.         else {
  87.             echo "There was an error getting the firmwares.<br />\n";
  88.             echo $gapi->getErrorsStr();
  89.         }
  90.         break;
  91.     case 'protocol':
  92.         $protocols $gapi->getProtocols();
  93.         if$protocols {
  94.             echo '<ul>';
  95.             foreach$protocols as $protocol {
  96.                 echo '<li>';
  97.                 echo '<ul>';
  98.                 echo "<li>Title: $protocol->title</li>";
  99.                 echo "<li>Description: $protocol->description</li>";
  100.                 echo '</ul>';
  101.                 echo '</li>';
  102.             }
  103.             echo '</ul>';
  104.         else {
  105.             echo "There was an error getting the protocols.<br />\n";
  106.             echo $gapi->getErrorsStr();
  107.         }
  108.         break;
  109.     case 'channel':
  110.         $protocol "802.11b";
  111.         $channels $gapi->getChannels($protocol);
  112.         if$channels {
  113.             echo '<ul>';
  114.             foreach$channels as $channel {
  115.                 echo '<li>';
  116.                 echo '<ul>';
  117.                 echo "<li>Title: $channel->title</li>";
  118.                 echo "<li>Description: $channel->description</li>";
  119.                 echo '</ul>';
  120.                 echo '</li>';
  121.             }
  122.             echo '</ul>';
  123.         else {
  124.             echo "There was an error getting the channels.<br />\n";
  125.             echo $gapi->getErrorsStr();
  126.         }
  127.         break;
  128. }
  129.  
  130. ?>

Documentation generated on Sun, 10 Jan 2010 21:02:49 +0100 by phpDocumentor 1.4.3