Do you support the SimpleXML extension for PHP?
Ce contenu n’est pas encore disponible dans votre langue.
Yes. The SimpleXML extension is available for PHP on Ruachost hosting.
SimpleXML turns an XML document into a PHP object, so you can read elements and attributes with normal PHP code. It’s useful for reading RSS feeds, product feeds and API responses.
<?php$xml = simplexml_load_file('feed.xml');foreach ($xml->channel->item as $item) { echo $item->title . "\n";}If you get a “Call to undefined function” error
Section titled “If you get a “Call to undefined function” error”PHP extensions are managed for each PHP version. To check that SimpleXML is switched on:
- Log in to cPanel.
- Open Select PHP Version.
- Click Extensions and make sure simplexml (and xml) are ticked.
See Changing PHP versions and settings using PHP Selector.
If your script reports a “String could not be parsed as XML” error, the problem is usually the XML itself. See Fixing the String could not be parsed as XML PHP error message.
Cette page vous a-t-elle aidé ?
Merci pour votre retour.