0

Hi guys

i'm in the process of writing an API and is stuck.

I get this error:

Parse error: syntax error, unexpected T_STRING in /var/www/xxxxxxx.xxx/public_html/api/uentry.php on line 35

Here's the code:

<?php
include '../../cfg/xmlhttpheader.inc';
// ---- Form l:
// ---- 1) Rense parameter streng 
// ---- 2) Omdirigere forspørgsler til /api
// include '../../api/uhandler.php';
$RqOK = false;
$success = '';
$Errnr = 0;
$Rspmsg = '';
if (isset($_POST['RqID']))  // unders ger om request parametren er sat
 {
  $RqID = $_POST['RqID'];
    if (strlen($RqID) > 0) // hvis ja, unders ger om den har noget indhold
     {
     $RqOK = true;
     }
     else
    {
     $success = 'n';
     $Errnr = 1000;
     $Rspmsg = 'Ulovligt fors g p  adgang til sitet! K rsel afbrudt';
    }
 } // end if isset($_POST['RqID'])
 if ($RqOK)
  {
  // redirect to api entry
  }
  else
 {
  $success = 'n';
  $Errnr = 1001;
  $Rspmsg = 'Ulovlig forespørgsel, kørsel afbrudt';
?>
<?xml version="1.0" encoding="UTF-8"?>   **// LINE 35**        
<!DOCTYPE Response>
 <Response>
  <Succes><?php echo($success)?></Succes>
  <Ernr><?php echo($Errnr)?></Ernr>
  <Msg><?php echo($Rspmsg)?></Msg>
 </Response>
<?php
 }
?>

---------------------------------------------------------------------------

What am I missing?

Any suggestions?

I know the question has been raised before, but going through the answers and searching the manual has got me nowhere.

2
Contributors
2
Replies
21
Views
4 Years
Discussion Span
Last Post by Hans B
0

I'd output the xml tag in an echo statement. My guess is it thinks the <? is opening PHP tags. Try:

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
0

@EvolutionFallen

Bingo :) it works. Thanks for the pointer.

It must be a server setting thing, because on my local host the script ran smoothly.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.