Tiffu Beschreibung
(Unterschied zwischen Versionen)
(→API) |
(→API) |
||
Zeile 10: | Zeile 10: | ||
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 39: | Zeile 37: | ||
$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> | </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 ); ?>