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

    Join Date
    Apr 2005
    Posts
    27
    Rep Power
    0

    Help me check my wap php page


    hi, I've just converted my index.wml file to php to use the dynamic features of php.

    Here's what i add to the wml to make it into index.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\">"; 
    ?>
    
    - Original WML code -
    am i doing it right?

    Then when i tried to add a php feature (a dynamic image banner) into the wml part of the script, something goes wrong. It loads correctly on my phone, but it doesn't when i tried to view it on Opera or wap emulator.

    This is the code that i tried to add into the WML section of my code:

    Code:
    <p align="center">
    <?
    $adsid = rand(1, 240);
    $ts = time();
    echo("<a href=http://click.buzzcity.com/click.php?bid=$adsid&partnerid=1234&ts=$ts><img
    src=http://ads.buzzcity.com/show.php?bid=$adsid&partnerid=1234&ts=$ts></a>"); 
    ?></p>
  2. #2
  3. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    Your &'s need to be &amp;'s

    I would also avoid using php short tags (<?) too,
    as it can sometimes cause confusion with xml tags...

    Do you get any errors with Opera?
    Additionally, I have found that setting the header as follows sometimes makes a difference:
    PHP Code:
    <?php
    header
    ("Content-type: text/vnd.wap.wml, true");
    ?>
    Also, you need to close all your tags properly.
    In this case: <img />

    Cheers,
    Jamie

    >_ skiFFie ? | Twitter

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2005
    Posts
    27
    Rep Power
    0
    Originally Posted by jabba_29
    Your &'s need to be &amp;'s

    I would also avoid using php short tags (<?) too,
    as it can sometimes cause confusion with xml tags...

    Do you get any errors with Opera?
    Additionally, I have found that setting the header as follows sometimes makes a difference:
    PHP Code:
    <?php
    header
    ("Content-type: text/vnd.wap.wml, true");
    ?>
    Also, you need to close all your tags properly.
    In this case: <img />
    still doesn't seem to work. the error's at the <a href=> part.
    do i have to add ' or " to it?
  6. #4
  7. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    Yes, I missed that.
    You need to use valid xml/wml.....
    This means you must quote all your attributes and close all tags...
    See the WAP Resources sticky -
    there is a link to a wml validator there - use it....

    Cheers,
    Jamie

    >_ skiFFie ? | Twitter

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2005
    Posts
    27
    Rep Power
    0
    tried the validator but it says fatal error:

    here's what i have:
    Code:
    <p align="center">
    <?php
    header("Content-type: text/vnd.wap.wml, true"); 
    $adsid = rand(1, 240);
    $ts = time();
    echo("<a href="http://click.buzzcity.com/click.php?bid=$adsid&amp;partnerid=1234&amp;ts=$ts"><img
    src="http://ads.buzzcity.com/show.php?bid=$adsid&amp;partnerid=1234&amp;ts=$ts" /></a>"); 
    ?></p>
  10. #6
  11. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    You must send the header before anything is sent to the browser:
    is: before <p ..... in this case.

    Show your outputted source code...
    this link / text must be within the <card>

    Cheers,
    Jamie

    >_ skiFFie ? | Twitter

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Wap


    how to use wap script in php?
  14. #8
  15. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    Please don't bump 4 year old threads

    No Google where you come from ??
    http://www.developer.com/ws/proto/ar...n-with-PHP.htm

    Cheers,
    Jamie

    >_ skiFFie ? | Twitter

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________

IMN logo majestic logo threadwatch logo seochat tools logo