Tiffu Beschreibung
(Unterschied zwischen Versionen)
(Die Seite wurde neu angelegt: „= Tiffu.com = == ... == == API == Beispiel: <code> include( "../cfg.php" ); include( "../mysqldb.php" ); include( "tiffuapi.php" ); def…“) |
(→API) |
||
(Der Versionsvergleich bezieht 2 dazwischenliegende Versionen mit ein.) | |||
Zeile 5: | Zeile 5: | ||
== API == | == API == | ||
Beispiel: | Beispiel: | ||
- | < | + | <pre> |
+ | <? | ||
include( "../cfg.php" ); | include( "../cfg.php" ); | ||
include( "../mysqldb.php" ); | include( "../mysqldb.php" ); | ||
include( "tiffuapi.php" ); | include( "tiffuapi.php" ); | ||
- | + | ||
- | + | $tiffu_user = 'tiffu'; | |
- | + | $tiffu_password = '*****'; | |
- | + | ||
- | + | // API-Key für die zu beschreibende Variable | |
- | + | define( 'REG_USER', 'ba7c61f9099a19234b2c5db969fddd02' ); | |
- | define( 'REG_USER', | + | |
- | + | ||
$db = new MySQLDB( $_CFG['DB_HOST'], $_CFG['DB_NAME'], $_CFG['DB_USER'], $_CFG['DB_PASS'] ); | $db = new MySQLDB( $_CFG['DB_HOST'], $_CFG['DB_NAME'], $_CFG['DB_USER'], $_CFG['DB_PASS'] ); | ||
- | $request = new TiffuAPI( | + | $request = new TiffuAPI( $tiffu_user, $tiffu_password ); |
function getCount( $sqlcmd ) | function getCount( $sqlcmd ) | ||
Zeile 35: | Zeile 34: | ||
else | else | ||
echo "success<br>\n"; | echo "success<br>\n"; | ||
- | } | + | } |
- | + | ||
$reg_user = getCount( "select count(*) from state_user" ); | $reg_user = getCount( "select count(*) from state_user" ); | ||
- | |||
- | |||
- | |||
- | |||
- | |||
echo "reg_user: $reg_user<br>\n"; | echo "reg_user: $reg_user<br>\n"; | ||
updateVar( REG_USER, $reg_user ); | updateVar( REG_USER, $reg_user ); | ||
- | + | ?> | |
- | + | </pre> | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | </ | + |
Aktuelle Version vom 08:30, 10. Aug. 2010
Tiffu.com
...
API
Beispiel:
<? include( "../cfg.php" ); include( "../mysqldb.php" ); include( "tiffuapi.php" ); $tiffu_user = 'tiffu'; $tiffu_password = '*****'; // API-Key für die zu beschreibende Variable define( 'REG_USER', 'ba7c61f9099a19234b2c5db969fddd02' ); $db = new MySQLDB( $_CFG['DB_HOST'], $_CFG['DB_NAME'], $_CFG['DB_USER'], $_CFG['DB_PASS'] ); $request = new TiffuAPI( $tiffu_user, $tiffu_password ); function getCount( $sqlcmd ) { global $db; $query = $db->query( $sqlcmd ); return $query->getFirstField(); } function updateVar( $key, $value ) { global $request; if( !$request->setVar( $key, $value ) ) echo $request->getError()."<br>\n"; else echo "success<br>\n"; } $reg_user = getCount( "select count(*) from state_user" ); echo "reg_user: $reg_user<br>\n"; updateVar( REG_USER, $reg_user ); ?>