first time poster here athough I have been visiting this site for years. Anyways I'm trying to make a simple script that displays a list of emails in an imap inbox thatworks on my phone but for some reason I cant get it to work. Script coments explain it.
list.php
<?
// does not work
// gives error of(Openwave Browser 4.1.27al WAP 1.1 on Motorola iDen phones):
// 500: Web service problem: Please contact the service provider.
// 1019 Compile error.
// if comenting out connects to imap section or code it works fine
// outputs the correct content type
header("Content-type: text/vnd.wap.wml");
// connection vars to check messages
$server = "{localhost/imap}";
$email = "";
$password = "";
// connects to imap and displays the text messages in a list
$link = imap_open($server,$email,$password);
$headers = imap_headers($link);
$numEmails = sizeof($headers);
echo '<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="Text Inbox">
<p>Text Inbox:<br/>';
for($i = 1; $i < $numEmails+1; $i++){
$mailHeader = @imap_headerinfo($link, $i);
$from = $mailHeader->fromaddress;
$subject = strip_tags($mailHeader->subject);
$message = @imap_body($link, $i);
$message = substr($message, 0, 20);
echo "<a href=\"pager.php?page=read_txt&num=$i\">$from|$subject| $message</a><br>";
}
echo'</p></card></wml>';
?>