#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    1
    Rep Power
    0

    unable to generate WML with PHP


    Hi,

    I am trying to generate WML with PHP. i have added this line to my httpd.conf:

    AddType*application/x-httpd-php*.wml

    and am testing this simple script (test.wml):

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

    <wml>
    <card id="card1" title="Example 1">
    <p>
    Hello World
    </p>
    </card>
    </wml>

    However i get this... 500: Web service problem: Please contact the service provider.

    any ideas why this is not working?

    thanks for any help
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    Beverly Hills
    Posts
    45
    Rep Power
    11

    Oh no!


    No no no! Take out the AddType directive. Here is what is happening:

    You have just set it up so that the server hands all .wml files over to the PHP module (take a look at: http://chiralsoftware.net/manual/man...ernalreference if you want to learn more than you wanted to know about this).

    So, all .wml gets handed over to the PHP interpreter, which then sets the mime type to its default MIME type and then executes the script. Problem: PHP's default mime type is text/html. So, by putting in that AddType all of your .wml files are interpreted as PHP and all of them get the default PHP mime type. Neither of these are what you want most likely.

    Now, you are probably about to say right now "but I put the Header command in which would set the content type correct even so." Maybe! Maybe maybe. The problem is that if there is any output before the header command, the header command has no effect (as far as I remember). This means that if there is a space or a return, that header command isn't doing anything.

    So, take out the AddType, rename your file to a .php file, and make sure there are no spaces or output of any kind before the Header directive is reached. PHP may also have a set-content-type directive that you can use without having to manipulate the header directly.

    -----------
    WAP hosting

IMN logo majestic logo threadwatch logo seochat tools logo