»
S
I
D
E
B
A
R
«
Php WEB REDIRECT Script
Dec 21st, 2009 by anand

A Small Php Script to redirect Browsers:

Wap Redirect is a small script written in PHP. The aim of Wap Redirect is to detect the browser & find out if it’s a normal PC Browser or a wml Browser on a mobile phone (Or a iphone or PSP). After detecting the browser the script redirects the user to respective links.

Click to Download File

Thanks to the creators

Why does a normal HTTP redirect does not work in WAP?
Dec 21st, 2009 by anand

Why does a normal HTTP redirect does not work in WAP?

The truth is that it does. The crucial detail is the server side script language, or rather the interaction between the server side script language and the web server.

The so called 302 Found HTTP response basically means that the web server tells the user agent that the resource may be found elsewhere, temporarily. Some web servers happen to add a Content-type: to the response even if there is no content. By default the Content-type: is in normal circumstances text/html.

Actually, the HTTP specifications on "302 Found" say that the web server, unless the request method was HEAD and not GET, should also send a body containing a short message for the (human) user saying that the location has changed. In WML‘s case, the short message must obviously be a full WML deck with one card. If the gateway/browser fully supports a redirect, the message will not be shown. If it doesn’t, the user will have to manually follow the link to the new location. This is crucial if your script may output any characters, either on purpose or by mistake. ASP is famous for outputting whitespaces where there should be none. This doesn’t cause a problem for a HTML browser, but will certainly do so for a WML browser.

Note that none of the examples below contain a body – just the header.

Thanks to Al Sutton, John McAleely and Patrice Slupowski, the following code examples have been tested and found to work on Apache and Microsoft Internet Information Server. If you use another web server or another script language, you should be able to convert these rather simple script snippets. And the keyword is simple. No need to tell the web server to generate a full HTTP header unless you need to. Most web servers will complement the header so that the user agent understands it. This is just to override what’s absolutely required as a minimum.

All code examples are available for testing online. If they work, you will be redirected to http://t.wurfl.com/ which generates a WML deck with a card that displays all HTTP headers.

PHP code example which can be tested at http://t.wurfl.com/wap1redir.php:

<?
  header("Location: http://t.wurfl.com/");
  header("Content-type: text/vnd.wap.wml";
?>

Perl code example:

print "Location: http://t.wurfl.com/\n";
print "Content-type: text/vnd.wap.wml\n";

James Skinner adds that with Perl you can use the No-Parsed-headers option which will produce the complete HTTP response so that the web server does not have to:

#!/usr/local/bin/perl
 
use CGI qw(:standard);
 
print redirect(-uri=>'http://james.istop.com/redirected.wml',-nph=>1);

This requires informing the web server that the script is a nph script (on Unix you rename the script to start with nph- on NT IIS figures this out by itself )

ASP code example (note different URL):

<%
  Response.Redirect("http://t.wurfl.com/")
  Response.ContentType = "text/vnd.wap.wml"
  Response.Flush
  Response.End
%>

Lately, Luca Passani has released the Switcher, http://www.passani.it/switcher/, a Java servlet with a high-degree of logic that will tell a desktop browser from a mobile browser *programmatically*. While the Switcher is not open source, the source code can be purchased for a fee.

Using HTTP 303

From http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html:

Note: RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client.

If you try to redirect a browser after a form using POST (for example for a login page), the browser should use the same HTTP method on the redirect location (POST to redirect location) which causes several handsets to print a security warning. With a 303 redirect, the redirect location is retrieved with a GET instead of POST.

Unfortunately, not all browsers support a 303 redirect. There are several older Nokias that do not support it.

Browser peculiarities

Some browsers seem to not like so much to be redirected. Notably Nokia series 40 DP 1.0, when redirected to a different server will alert the user with an “Unsupported Content” without even requesting the page. Later Developer Platforms of the same Nokia serie do not present this problem.

Other sporadic issues are periodically reported.

HTTP 302 redirect work-arounds

In WML you may use the onenterforward tag. We suggest that you also provide a short text notifying the user of the redirection and a link in case there’s any problem. Example:

<onevent type="onenterforward">
     <go href="/index.wml"/>
</onevent>

The same can be achieved in XHTML using the meta tag. Example:

<meta http-equiv="refresh" content="5;url=http://t.wurfl.com/">

Thanks

Apple ‘tablet’ is just a bigger iPhone?
Dec 11th, 2009 by anand

Conjecture about future Apple products is always an interesting exercise because it requires a lot of imagination to make up for the copious lack of hard data. This is especially the case for the rumored Apple tablet, despite analyst claims about product specifications, such as the oft-repeated 10.1-inch screen.

But there is one theme that keeps popping up that is highly plausible: it will be a device to view media and book content (rumor: 30/70 revenue split between Apple/publisher) in a “better” way. Hmm…let me think for a minute: the same way many people now use their iPhone? (Certainly, the media part.) So–though not a phone per se–basically an iPhone (or iPod) with a bigger screen, faster graphics, and better interface (and/or subscription model) to view content.

Apple tablet

Does that about cover it? That doesn’t sound like a tablet to me, with all the negative connotations that the word “tablet” has in the PC industry: fat, heavy, kludgey, boring.
Which is why “media pad” sounds a lot better. That, to me at least, connotes thin, light, modern, exciting. But I’ll leave the branding to Apple. So far, they have a pretty good track record.

ALL ABOUT THE MOBILE TECHNOLOGY: HISTORY, PRESENT & FUTURE
Dec 1st, 2009 by anand

Everybody is aware of the fact that the technology keeps on evolving from one form to the other everyday & for all the stuff related to it. This pattern of changing & improving mobile technology makes it very complicated for the people to use the mobiles with the latest technology. The terms like 3G, GSM, TDMA, CDMA, FDMA, GPRS, WAP, EDGE, etc. are not so understandable as far as the common people are concerned, who cannot digest such terminologies of the changing Mobile Technology.

Generations of Mobile Communication

The terms 3G, has evolved from the other terms like 1G, 2G, etc. where they indicate the generation of the mobile communication. For example, 1G is the short form of 1st Generation, and so on. This 1G mobile was introduced or launched in 1970s, which was primarily used for only voice transfers. The 2G-2nd Generation mobiles came into existence in 1990s, which was further developed to 2.5G including GSM, TDMA & CDMA. These mobiles were used for transferring voice & data.

The present generation of mobiles is 3G, which delivers the data speed from 384kbps to 2mbps over the wireless interfaces like GSM, TDMA & CDMA.

FDMA: Frequency Division Multiple Access

FDMA uses separate frequencies for each call and they do not interfere amongst themselves, which limits the number of users because of this reason.

TDMA: Time Division Multiple Access

TDMA allocates unique time slots to each user within each channel, enabling many users to access the radio frequency without anybody else’s invitation. Each mobile conversation uses only a particular frequency slot of the time.

CDMA: Code Division Multiple Access

This was commercially used in 1995 by Qualcomm & had become very quickly & fastest growing wireless mobile technology. The 3G CDMA network provides more clarified voice traffic with the high-speed data capabilities. This technology enables a very wide usage of the features of a mobile phone & also it is one of the cost-saving technology where the people can get many benefits with the lowest possible costs.

GSM: Global System for Mobile

GSM was developed by TDMA protocol in Europe, which has become a standard mobile technology for mobiles across the globe. It provides a very high level of security & a superior sound quality. This technology is globally accepted, which needs a SIM card (Subscriber Identity Module) that contains the telephone service account information subscribed by you. These SIM cards are different based on the location of the person. The card of one location cannot be used on other location, unless & until your service provider approves for it.

GPRS: General Pocket Radio Services

GPRS is an enhancement to the GSM mobile technology that offers the high-speed connectivity to the internet. With this facility, you can check the emails, download games, transfer the messages to the computer, etc. which can be browsed at a very high-speed.

WAP: Wireless Application Protocol

WAP is the portable internet access facilitating technology through the mobiles. If anyone wants to use the internet over the mobile, or wants to see the web content on mobile, it is necessary to have the WAP enabled mobile & the WAP service enabled by the service provider. This mobile technology, like GPRS, enables the downloads of the games, send email, transfer the messages to the computer, etc.

EDGE: Enhanced Data GSM Environment

This mobile technology has specifically been designed to meet the bandwidth needs of 3G. EDGE was introduced by Ericsson & it offers high-speed data transfers over the GSM networks with just a software upgrade to the handset. This technology allows the speed up to 384kbps.

The journey of the mobile technology development with all these evolutions has facilitated the people to such a higher extent, that the future of these technologies is seen to be very bright. The technology will never stop evolving & so will the people’s ideas, ensuring better ways of using the mobile phones.

»  Substance: WordPress   »  Style: Ahren Ahimsa