| Sample Code |
How can I retrieve the values of the capabilities of wurfl ?Retrieve the values of WURFL capabilities is very simple all the information are defined as the Apache environment AMF_ for example:
How to read environment in PHP ?
$_SERVER['AMF_MAX_IMAGE_HEIGHT']; a test page in php is downloadable at this link. demo PHP page is avaiable:http://www.apachemobilefilter.org/test/php_test.php Here you can download the source: php_test.php.zip How to read the value in JSP (for Tomcat)?
JkEnvVar AMF_MAX_IMAGE_HEIGHT undefined The Java code is: request.getAttribute("AMF_MAX_IMAGE_HEIGHT") How to read the value in PERL?
Simple ?
Here a little example how I build an Mobile Ticket System (demo). Below the code: index.php <?php Here the code to generate the QRCode qr.pl: #!/usr/bin/perl use GD::Barcode::QRcode; use Apache2::AMFCommonLib;
print "Content-Type: image/png\n\n"; $size=3; if ($ENV{AMF_MAX_IMAGE_WIDTH} > 160) {
$size=5; } if ($ENV{AMF_MAX_IMAGE_WIDTH} > 220) {
$size=7; } if ($ENV{AMF_MAX_IMAGE_WIDTH} > 240) {
$size=8; } if ($ENV{AMF_MAX_IMAGE_WIDTH} > 280) {
$size=9; } if ($ENV{AMF_MAX_IMAGE_WIDTH} > 330) {
$size=15; } my $CommonLib = new Apache2::AMFCommonLib (); $data=Date(); print GD::Barcode::QRcode->new("AMF $data", { Ecc => 'L', Version=>2, ModuleSize => $size})->plot->png;
sub Date {
my $_sec; my $_min; my $_hour; my $_mday; my $_day; my $_mon; my $_year; my $_wday; my $_yday; my $_isdst; my $_data; ($_sec,$_min,$_hour,$_mday,$_mon,$_year,$_wday,$_yday,$_isdst) = localtime(time); $_mon=$_mon+1; $_year=substr($_year,1); $_mon=&correct_number($_mon); $_mday=&correct_number($_mday); $_hour=&correct_number($_hour); $_min=&correct_number($_min); $_sec=&correct_number($_sec); $_date="$_hour:$_min:$_sec"; return $_date; } sub correct_number {
my ($number) = @_; if ($number < 10) {
$number="0$number"; } return $number; }
Commenti (0)
Solo gli utenti registrati possono scrivere commenti!
Powered by !JoomlaComment 4.0 beta2
|
AMF V3 menu
Support
| AMF Ticket System |
Newsletter
by Zaragoza Online
AMF Activity
| SourceForge.net - Recent activity for project: mobilefilter |
| Recent activity for the project mobilefilter |
|





The php code is:
Before in the httpd.conf file where you have configure mod_jk you must add this:
print $ENV('AMF_MAX_IMAGE_HEIGHT');
