SimpleXMLElement doesn’t work!
Check php -v:
JavaScript
x
PHP 7.4.8 (cli) (built: Jul 13 2020 16:45:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
php -m:
JavaScript
php -m
[PHP Modules]
SimpleXML
..
xml
xmlreader
xmlwriter
xsl
I used PHP 7.2, install php-xml, php-simplexml and etc.
log:
JavaScript
PHP Fatal error: Uncaught Error: Class 'SimpleXMLElement' not found in /var/www/html/inc/functions.php:828
php:
JavaScript
$myCurl = curl_init();
curl_setopt_array($myCurl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(array($body))
));
$response = curl_exec($myCurl);
curl_close($myCurl);
$robo_response = new SimpleXMLElement($response);
Advertisement
Answer
On my Ubuntu enabled PHP7.0. Need PHP 7.4
JavaScript
sudo a2dismod php7.0
sudo a2enmod php7.4
sudo service apache2 restart
Thx for help everybody.