PHP & 406 Not Acceptable

Discussion in 'PHP' started by merianos, Jan 3, 2009.

  1. #1
    Hello all ! ! !

    I have a litle problem with a script that I have create.

    This script selecting from the database all the records (in total 2) and then print out a XML file.

    I have enter this code to change the header to XML :

    header('Content-type: application/xml; charset="utf-8"');

    and then i print out hte records of the MySQL query :

    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

    echo "<languages>";

    while($rows = @mysql_fetch_array($resLNGS, MYSQL_ASSOC))
    {

    echo "<lngs>";

    if((isset($_POST['lngs_id']) && strlen($_POST['lngs_id'])>0) && ($_POST['lngs_id'] == $rows['ID']))
    {
    echo "<id default=\"" . $rows['ID'] . "\">" . $rows['ID'] . "</id>";
    }
    else
    {
    echo "<id>" . $rows['ID'] . "</id>";
    }
    echo "<name>" . $rows['NAME'] . "</name>";

    echo "</lngs>";

    }

    echo "</languages>";

    That's all my code and then I'm getting from the server the following headers :

    http://xx.x.xxx.xx/~babis08/CPanel/xml/languages.php

    POST /~babis08/CPanel/xml/languages.php HTTP/1.1
    Host: 62.1.216.81
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; el; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 FirePHP/0.2.1
    Accept: application/xml, text/xml, */*
    Accept-Language: el
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-7,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    X-Requested-With: XMLHttpRequest
    Referer: http://xx.x.xxx.xx/~babis08/CPanel/prop ... insert.php
    Cookie: PHPSESSID=4181110c8e9c2f68d7f758030aa2bbe4
    Pragma: no-cache
    Cache-Control: no-cache

    HTTP/1.x 406 Not Acceptable
    Date: Sat, 03 Jan 2009 08:22:17 GMT
    Server: Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.4 Perl/v5.8.8
    Content-Length: 599
    Keep-Alive: timeout=5, max=63
    Connection: Keep-Alive
    Content-Type: text/html; charset=iso-8859-1

    What can i do for ? ? ?

    thanks a lot
     
    merianos, Jan 3, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    You just need
    header('Content-Type: text/xml');
    PHP:
     
    Kaizoku, Jan 3, 2009 IP
  3. merianos

    merianos Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It doesn't work.

    I change the Content-type and it doesn't work
     
    merianos, Jan 6, 2009 IP