Hi there
can anyone help in this problem

I just writed some lines of code that should take some values from one url by splitting at the end the page source into string.

the problem is that the code is working perfectlly in a emulator (e.g WinWap 3.01) but on my nokia 6510 I get No
Gateway Reply answer.

If I remove the part of string transforming in card two all works ok... so the problem I think is the time until the server splits and extract the right value.

the page can be seen on http://wap.cinecitta.biz/


<?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\">";
$the_hour = date("H");
$the_day = date("d");
$the_month = date("m");
$the_year = date("Y");
?>
<wml>
<card id="card1" title="Search Trains">
<p align="center">
<do type="accept" label="Accept">
<go href="#card2" method="post">
<postfield name="Stazin" value="$stazin"/>
<postfield name="Stazout" value="$stazout"/>
<postfield name="Datag" value="$datag"/>
<postfield name="Datam" value="$datam"/>
<postfield name="Dataa" value="$dataa"/>
<postfield name="Timsh" value="$timsh"/>
</go>
</do>
Departure Station:<br/>
<input value="Torino" title="Stazin" name="stazin"/><br/>
Arrival Station:<br/>
<input value="Roma" title="Stazout" name="stazout"/><br/>
Day of departure:<br/>
<input value="<?php echo $the_day ?>" title="Datag" name="datag"/><br/>
Month of departure:<br/>
<input value="<?php echo $the_month ?>" title="Datam" name="datam"/><br/>
Year of departure:<br/>
<input value="<?php echo $the_year ?>" title="Dataa" name="dataa"/><br/>
Hour of departure:<br/>
<input value="<?php echo $the_hour ?>" title="Timsh" name="timsh"/><br/>
</p>
</card>
<card id="card2" title="Returned results">
<?php
$stazin = $_POST['Stazin'];
$stazout = $_POST['Stazout'];
$datag = $_POST['Datag'];
$datam = $_POST['Datam'];
$dataa = $_POST['Dataa'];
$timsh = $_POST['Timsh'];
$where = "http://62.110.170.234/webapp/trenitalia/TimeTable?stazin=".$stazin."&stazout=".$stazout."&datag=".$datag."&datam=".$datam."&dataa=".$dataa."&timsh=".$timsh."&timsm=00&lang=it&nreq=5&sort=0&npag=1&det=1";
$Stop1 = "</FONT></A><FONT size=\"1\" face=\"Verdana,Arial\" color=\"#000000\">&nbsp;</FONT></TD><TD><FONT size=\"1\" face=\"Verdana,Arial\" color=\"#000000\">";
$Start2 ="</FONT></TD><TD align=\"middle\"><FONT size=\"1\" face=\"Verdana,Arial\" color=\"#000000\">";
$return = implode('', file($where));
$index1 = strpos($return, $Stop1);
$index1 += strlen($Stop1);
if ($index1 == -1) die ("Could not find Start1 in news!");
$index2 = strpos($return, $Start2);
if ($index2 == -1) die ("Could not find Start2 in news!");
$length = $index2 - $index1;
$message = substr($return, $index1, $length);
$news .= $message;
echo $news;
?>
</card>
</wml>