Introduction to WML, Apache, and PHP

Source: Internet
Author: User
WML, Apache, and PHP are introduced on the company's website. I found that I needed an email that could receive me wirelessly, stock market information, etc. I don't want to pay people to get the information I want. I decided to develop a wireless website. such information is okay on the Internet, but it is scattered and difficult to collect. I need to be able to execute php, access the database, and I need PHP to provide other functions for me. This article covers the basics of wml and how to build your apache Server and php. These foundations allow you to build an environment and learn the background applications on your own.
 

Request
You have some experience with Apache Web Server, Php, and html. for system requirements, I used apache 1.3.9, php3, and Red Hat Linux 6.0 for demonstration. I have not encountered any problems on windows running Apache, and PHP3 or PHP4.

In this article, I will guide you through the following areas: wml introduction, setting wireless appications on Apache, and building your first WML/PHP web page. most of the information can be collected from the Internet.

WML introduction
WML stands for wireless annotation language. WAP phones or similar devices are used for web pages written in WML. WML is based on syntaxes similar to XML and scrictness. Anyone who has used html will learn WML without any problem. Many labels and attributes are the same, and there are not many tags. WML allows program developers to develop dynamic content, although for this article we will use PHP as a dynamic language.

WML basics
In WML, you can use many subpages (called "cards'') in a WML page (called "deck "). the function of each WML card is as follows. the following will be us. wml page example. On my Server, I am in ~ /Wireless/home. wml stores this file

 

My first test page





Unlike HTML, if you do not use the colse tag, for example In this example, a simple test message "My first test page" is generated on any wireless device ".

Set Apache
Well, what's interesting now. in order for apache to catch wireless devices to visit your Server, you need to build your httpd. conf (my files are stored in/etc/httpd/conf/) files. I use PHP3, so all changes will be recorded. Before you start, you can back up your httpd. conf file, just in case :)

Step 1: First, we need the AddType function to add a new MIME type. You need to go to the Script that defines php. It looks like the following:


AddType application/x-httpd-php3. php3. php. phtml

AddType application/x-httpd-php3-source. phps



To change:

 


AddType application/x-httpd-php3. php3. php. phtml. wml

AddType application/x-httpd-php3-source. phps


This will use PHP compiler on all. wml pages.

Step 2: Remove Mark (Uncomment) apache Load Module and Add Module

Change:


# LoadModule rewrite_module modules/mod_rewrite.so

# AddModule mod_rewrite.c
 

To:

LoadModule rewrite_module modules/mod_rewrite.so

AddModule mod_rewrite.c


Step 3: Use apache mod_rewrite module (applicable only to version 1.2 and later ). with this, you can instantly rewite requested URL (when the condition is met ). you need to put this code block at the bottom of the webpage.

 

RewriteEngine On

# Catch most WAP browsers

RewriteCond % {HTTP_ACCEPT} text/vnd \. wap \. wml [OR]

# WinWAP, WAPjag

RewriteCond % {HTTP_USER_AGENT} wap [OR]

# Nokia emulators (sdk)

RewriteCond % {HTTP_USER_AGENT} 7110

# Rewrite to where your wireless page is located

RewriteRule ^ [\./] (. *) $/home/mydirectory/wireless/home. wml [L]


Restart apache server.

 

Generate Your first wireless WML/PHP web page
Okay. now that everything is ready, let's build the first web page. To work properly, you need to transmit the correct header information.

# Send the header information

Header ("Content-type: text/vnd. wap. wml ");

?>

# Put in the wml code






My first test page





You just completed your first "simple" wireless web page. Now, let's try to do something harder.

You need to check your WAP-compatible website devices. I use Phone.com software development kit, which contains UP. Simulator and can check my wireless web page. Select a different phone number and watch their wireless web pages.


For more information, see:

Http://updev.phone.com
Http://www.wapforum.org
Http://www.wap.com
Http://www.waplinks.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.