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

Source for file examples.guifi_api.interface.php

Documentation is available at examples.guifi_api.interface.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 'add':
  26.         $device_id 19534;
  27.         $radiodev_counter 1;
  28.         
  29.         $added $gapi->addInterface$device_id$radiodev_counter );
  30.         if$added {
  31.             echo "Interface created correctly!!<br />\n<br />\n";
  32.             echo "The identificator of the new interface is: interface_id = <strong>$added->interface_id</strong>";
  33.             if$added->ipv4 {
  34.                 echo "<br /><br />\n\n";
  35.                 echo "New IPv4 configuration:<br />";
  36.                 echo '<ul>';
  37.                 foreach$added->ipv4 as $ipv4 {
  38.                     echo '<li>';
  39.                     echo "ipv4_type = $ipv4->ipv4_type<br />";
  40.                     echo "ipv4 = $ipv4->ipv4 <br />";
  41.                     echo "netmask = $ipv4->netmask<br />";
  42.                     echo '</li>';
  43.                 }
  44.                 echo '</ul>';
  45.             }
  46.         else {
  47.             echo "There was an error adding the interface.<br />\n";
  48.             echo $gapi->getErrorsStr();
  49.         }
  50.         break;
  51.     case 'delete':
  52.         $interface_id 26531;
  53.         
  54.         $removed $gapi->removeInterface$interface_id );
  55.         if$removed {
  56.             echo "Interface <strong>$interface_id</strong> removed correctly.<br />\n<br />\n";
  57.         else {
  58.             echo "There was an error deleting the interface.<br />\n";
  59.             echo $gapi->getErrorsStr();
  60.         }
  61.         break;
  62. }
  63.  
  64. ?>

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