SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me on WML and PHP5

    i am having a bad day trying wml in php. have done some configuration which were taken from http://www.zend.com/zend/tut/wap.php...1&anc=0&view=1

    but sill does not work at all.

    can someone help me on this thing? i need to test wml script alone, wml + php + mysql. currently, i can run wml script alone using Phone Simulator v7 from Openwave. but when i try to run wml+php, i get "Unsupported content type" error.

    below are some the codes that i cant run on Phone Simulator.

    PHP Code:
    <?php
    /*
    *wml inside php script
    */
    header("Content-type: text/vnd.wap.wml"); 
    echo 
    "<?xml version=\"1.0\"?>"
    echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
       
    " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"

    $name "Eizan";
    echo 
    "Welcome to WML Presentation. <br>";
    echo 
    "My name is " $name;
    ?>
    PHP Code:
    <?php 
    // send wml headers
    header("Content-type: text/vnd.wap.wml"); 
    echo 
    "<?xml version=\"1.0\"?>"
    echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
       
    " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    ?>

    <wml>
    <card id="card1" title="Example 1">
      <p>
        <?php 
    // format and output date
        
    $the_date date("M d Y");
        print 
    $the_date;
        print 
    "<br/>Welcome to a PHP-enabled site!"
        
    ?>
      </p>
    </card>
    </wml>

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont know much about wml, but this is what i would do.

    inspect the headers of a known working wml page.
    inspect the header your script generates.

    compare them.

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here are the headers that working.

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
    "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML Mobile 1.0//EN"
    "http://www.openwave.com/dtd/xhtml-mobile10.dtd">

    and here is the header that not working which is embeded in php script.

    header("Content-type: text/vnd.wap.wml");
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
    . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";


    but, if i put these lines in httpd.conf, the page that contains wml script alone, does not work.

    AddType text/vnd.wap.wml .wml
    AddType application/x-httpd-php .wml

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats text.
    im talking about the http headers.

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    thats text.
    im talking about the http headers.
    page that contains wml only and also got an error.

    <HTTP-raw> ******************************** HTTP Request ********************************
    <HTTP-raw> Lenght: 1876
    <HTTP-raw> Socket: 2
    <HTTP-raw> Host address: 127.0.0.1
    <HTTP-raw> URI: http://localhost:8080/wap/wml/wml1.wml
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> GET http://localhost:8080/wap/wml/wml1.wml HTTP/1.1
    <HTTP-raw> Host: localhost:8080
    <HTTP-raw> User-Agent: OPWV-SDK UP.Browser/7.0.2.3.119 (GUI) MMP/2.0 Push/PO
    <HTTP-raw> Accept-Charset: utf-8;q=1.0,big5;q=0.5,euc-jp;q=0.5,euc-kr;q=0.5,gb2312;q=0.5,gbk;q=0.5,iso-10646-ucs-2;q=0.5,iso-2022-jp;q=0.5,iso-8859-1;q=0.5,iso-8859-15;q=0.5,iso-8859-2;q=0.5,iso-8859-3;q=0.5,iso-8859-7;q=0.5,iso-8859-9;q=0.5,korean;q=0.5,ks_c_5601;q=0.5,ks_c_5601-1987;q=0.5,shift_jis;q=0.5,us-ascii;q=0.5,utf-16;q=0.5,utf-16be;q=0.5,utf-16le;q=0.5,windows-1252;q=0.5,windows-1253;q=0.5,windows-1254;q=0.5,windows-1255;q=0.5,windows-1256;q=0.5,windows-1257;q=0.5,windows-1258;q=0.5,x-euc-jp;q=0.5,x-sjis;q=0.5
    <HTTP-raw> Accept-Language: en-GB; q=1.0, en; q=0.8
    <HTTP-raw> X-Wap-Profile: "http://devgate2.openwave.com/uaprof/OPWVSDK70.xml"
    <HTTP-raw> Accept-Encoding: deflate,gzip
    <HTTP-raw> x-up-devcap-cc: 1
    <HTTP-raw> Referer: http://localhost:8080/wap/wml/
    <HTTP-raw> Accept: application/smil, application/vnd.oma.drm.content, application/vnd.oma.drm.message, application/vnd.oma.drm.rights+wbxml, application/vnd.oma.drm.rights+xml, application/vnd.phonecom.mmc-wbxml, application/vnd.phonecom.mmc-xml, application/vnd.wap.connectivity-wbxml, application/vnd.wap.mms-message, application/vnd.wap.multipart.mixed, application/vnd.wap.multipart.related, application/vnd.wap.wmlc;type=4365, application/vnd.wap.wmlscriptc, application/vnd.wap.xhtml+xml, application/xhtml+xml;profile="http://www.wapforum.org/xhtml", image/bmp, image/gif, image/jpeg, image/png, image/vnd.wap.wbmp, multipart/mixed, multipart/related, text/html, text/plain, text/vnd.wap.connectivity-xml, text/vnd.wap.wml;type=4365, image/svg+xml, image/pjpeg, application/x-shockwave-flash, image/x-vnd.openwave.lzrw1, application/vnd.openwave.svg, text/vnd.sun.j2me.app-descriptor, application/java-archive, application/java, application/vnd.oma.dd+xml, image/ems, audio/wav, audio/x-wav, audio/midi, audio/x-midi
    <HTTP-raw>
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> <<< Received 156 bytes on socket 2
    <HTTP-raw> <<<>>> Processing URI: http://localhost:8080/wap/wml/wml1.wml, length: 156. Pending Requests:
    <HTTP-raw> ******************************** HTTP Response ********************************
    <HTTP-raw> Length: 154 [Header: 154]
    <HTTP-raw> Socket: 2
    <HTTP-raw> Host address: 127.0.0.1
    <HTTP-raw> URI: http://localhost:8080/wap/wml/wml1.wml
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> HTTP/1.1 200 OK
    <HTTP-raw> Date: Sun, 20 Aug 2006 10:48:18 GMT
    <HTTP-raw> Server: Apache/2.0.55 (Win32)
    <HTTP-raw> X-Powered-By: PHP/5.1.2
    <HTTP-raw> Content-Length: 0
    <HTTP-raw> Content-Type: text/html
    <HTTP-raw> ******************************************************************************

    page that contains php and wml. it works.

    <HTTP-raw> ******************************** HTTP Request ********************************
    <HTTP-raw> Lenght: 1860
    <HTTP-raw> Socket: 3
    <HTTP-raw> Host address: 127.0.0.1
    <HTTP-raw> URI: http://localhost:8080/wap/php/php1.wml
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> GET http://localhost:8080/wap/php/php1.wml HTTP/1.1
    <HTTP-raw> Host: localhost:8080
    <HTTP-raw> User-Agent: OPWV-SDK UP.Browser/7.0.2.3.119 (GUI) MMP/2.0 Push/PO
    <HTTP-raw> Accept-Charset: utf-8;q=1.0,big5;q=0.5,euc-jp;q=0.5,euc-kr;q=0.5,gb2312;q=0.5,gbk;q=0.5,iso-10646-ucs-2;q=0.5,iso-2022-jp;q=0.5,iso-8859-1;q=0.5,iso-8859-15;q=0.5,iso-8859-2;q=0.5,iso-8859-3;q=0.5,iso-8859-7;q=0.5,iso-8859-9;q=0.5,korean;q=0.5,ks_c_5601;q=0.5,ks_c_5601-1987;q=0.5,shift_jis;q=0.5,us-ascii;q=0.5,utf-16;q=0.5,utf-16be;q=0.5,utf-16le;q=0.5,windows-1252;q=0.5,windows-1253;q=0.5,windows-1254;q=0.5,windows-1255;q=0.5,windows-1256;q=0.5,windows-1257;q=0.5,windows-1258;q=0.5,x-euc-jp;q=0.5,x-sjis;q=0.5
    <HTTP-raw> Accept-Language: en-GB; q=1.0, en; q=0.8
    <HTTP-raw> X-Wap-Profile: "http://devgate2.openwave.com/uaprof/OPWVSDK70.xml"
    <HTTP-raw> Accept-Encoding: deflate,gzip
    <HTTP-raw> x-up-devcap-cc: 1
    <HTTP-raw> Cache-Control: no-cache
    <HTTP-raw> Accept: application/smil, application/vnd.oma.drm.content, application/vnd.oma.drm.message, application/vnd.oma.drm.rights+wbxml, application/vnd.oma.drm.rights+xml, application/vnd.phonecom.mmc-wbxml, application/vnd.phonecom.mmc-xml, application/vnd.wap.connectivity-wbxml, application/vnd.wap.mms-message, application/vnd.wap.multipart.mixed, application/vnd.wap.multipart.related, application/vnd.wap.wmlc;type=4365, application/vnd.wap.wmlscriptc, application/vnd.wap.xhtml+xml, application/xhtml+xml;profile="http://www.wapforum.org/xhtml", image/bmp, image/gif, image/jpeg, image/png, image/vnd.wap.wbmp, multipart/mixed, multipart/related, text/html, text/plain, text/vnd.wap.connectivity-xml, text/vnd.wap.wml;type=4365, image/svg+xml, image/pjpeg, application/x-shockwave-flash, image/x-vnd.openwave.lzrw1, application/vnd.openwave.svg, text/vnd.sun.j2me.app-descriptor, application/java-archive, application/java, application/vnd.oma.dd+xml, image/ems, audio/wav, audio/x-wav, audio/midi, audio/x-midi
    <HTTP-raw>
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> <<< Received 347 bytes on socket 3
    <HTTP-raw> <<<>>> Processing URI: http://localhost:8080/wap/php/php1.wml, length: 347. Pending Requests:
    <HTTP-raw> ******************************** HTTP Response ********************************
    <HTTP-raw> Length: 334 [Header: 170]
    <HTTP-raw> Socket: 3
    <HTTP-raw> Host address: 127.0.0.1
    <HTTP-raw> URI: http://localhost:8080/wap/php/php1.wml
    <HTTP-raw> ******************************************************************************
    <HTTP-raw> HTTP/1.1 200 OK
    <HTTP-raw> Date: Sun, 20 Aug 2006 10:49:12 GMT
    <HTTP-raw> Server: Apache/2.0.55 (Win32)
    <HTTP-raw> X-Powered-By: PHP/5.1.2
    <HTTP-raw> Transfer-Encoding: chunked
    <HTTP-raw> Content-Type: text/vnd.wap.wml
    <HTTP-raw> <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">Welcome to WML Presentation. <br>My name is Eiza
    <HTTP-raw> ******************************************************************************
    Last edited by wackyflik; Aug 20, 2006 at 03:53. Reason: is this what u mean???

  6. #6
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my problem same with this person in this thread

    http://demo2.openwave.com:8080/jive3...=3585&tstart=0

    but still does not has any solution.

  7. #7
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    this what i used for 4 WML projects, i had no problems with it.

    // send wml headers
    @header("Content-type: text/vnd.wap.wml");

    //The first lines in the WML document are called the prolog.
    //The prolog defines that this is an XML document, it then defines the XML version,
    //and the DTD to be referenced.
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
    . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    ?>
    <!-- from here the wml tags -->
    <wml>
    <card title="">
    <p>
    <center><b>title</b><br /></center>
    <hr />
    </card>
    </wml>

    thanks

  8. #8
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tq satrun77, but i have tried so many ways configuring WML and PHP. how do you that to configure WML and PHP and what lines you put at the httpd?

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    inside Apache httpd.conf file past this:

    # MIME Types for WAP

    # For PHP 4.x, use this:
    AddType application/x-httpd-php .wml

    # For PHP 3.x, use this:
    AddType application/x-httpd-php3 .wml

    # For normal WML pages.
    AddType text/vnd.wap.wml .wml

    # For WML embedded graphics.
    AddType image/vnd.wap.wbmp .wbmp

    # End MIME Types for WAP

    Then save the file and restart the server.

    at the top of each file :

    <?php
    // send wml headers
    @header("Content-type: text/vnd.wap.wml");

    //The first lines in the WML document are called the prolog.
    //The prolog defines that this is an XML document, it then defines the XML version,
    //and the DTD to be referenced.
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
    . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    ?>

    save the file as .php

    some tutorials:
    Zend.com
    www.w3schools.com/wap
    http://www.developershome.com/ (this is good site)

    thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •