Announcement

Collapse
No announcement yet.

SimpleXML Hosting help.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleXML Hosting help.

    Trying to run some xml handling with php, although phpinfo says the module is installed it doesn't work on the server but does on localhost. Any help appreciated

  • #2
    Originally posted by Foddski View Post
    Trying to run some xml handling with php, although phpinfo says the module is installed it doesn't work on the server but does on localhost. Any help appreciated
    XML with PHP should work without any problems. Do you have any special settings done on localhost ? Also, if you can open up a support ticket with our helpdesk, we can further look into this issue.
    Kind regards,
    Jack Daniel.

    Cloud Hosting || Managed Dedicated Server || Webhosting UK Knowledgebase

    Comment


    • #3
      The Extensible Markup Language (XML) is a general purpose markup language that is commonly used to transfer data/information between two cooperating entities such as applications, servers or clients. The PHP supports rendering PHP variables as XML and manipulation of XML strings as PHP variables.

      There are a different two ways to handle XML data in PHP.
      From PHP scripts you can directly manipulate XML data using Simple XML-like objects derived from the following extension functions.

      * xml_decode
      * xml_encode

      xml_decode

      The following example illustrates how to parse XML data that has been sent in the POST body in to PHP variables.

      <?xml version="1.0" encoding="UTF-8"?>
      <employees>
      <employee id="345435">
      <name>John Smith</name>
      </employee>
      </employees>

      And xml encode:

      The function xml_encode can be used to encode PHP variables composed of primitive PHP types or arrays into an XML string. The following example shows an array being converted into a xml string.

      <?php

      $var = array('name' => "Smith", 'address' => array('line1' => 'This lane', 'line2' => 'Somewhere'));
      echo xml_encode($var, false, "employee");

      ?>

      This would return the following XML document.

      <?xml version="1.0" encoding="UTF-8"?>
      <employee>
      <name>Smith</name>
      <address><line1>This lane</line1><line2>Somewhere</line2></address>
      </employee>

      Comment

      Working...
      X