Results 1 to 6 of 6

Thread: Creating an XML File using PHP

  1. #1
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default Creating an XML File using PHP

    I have already set up some PHP script to create an XML document.

    However the header comes out like this:

    HTML Code:
    <?xml version="1.0"?>
    how can I cahnge it so that I get the heading:

    HTML Code:
    <?xml version="1.0" encoding="utf-8"?>
    The first part of my php code is:

    PHP Code:
    $doc = new DOMDocument(); 
    $doc->formatOutput true

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    UTF-8 is the default character set for XML 1.0 documents anyway. There's no need to specify it manually.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    OK, thats cool, thanks!

    I do have another question though...

    I have developed this script on my local host using PHP 5
    however when I upload it to my remote host the script doesn't work.
    Found out this is because they are running PHP 4.4.7.

    I've contacted my host but they arn't planning on upgrading it until next year, nor do I have the abbility to install anything as I'm using a shared server.

    Is there anyway that you know of that I can get round this?

    The error message i'm getting is:

    Fatal error: Cannot instantiate non-existent class: domdocument

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Tell them that PHP4 becomes officially obsolete in two months.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    I'll try but it doesn't sound like they'll action it in the near future plus I need it up and running in about a week.

    Is there a link to any documentation that i can send them to back up this info?


    In the meantime is there any other solution?

    Surely people have been using PHP4 to create XML documents?

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by jc_gmk View Post
    I'll try but it doesn't sound like they'll action it in the near future plus I need it up and running in about a week.

    Is there a link to any documentation that i can send them to back up this info?
    This is from php.net

    Quote Originally Posted by http://www.php.net
    PHP 4 end of life announcement
    [13-Jul-2007]

    Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

    The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

    For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.
    Hope this helps
    Last edited by thetestingsite; 11-02-2007 at 04:05 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •