2 years ago
#31237

Snappysites
Displaying Virtualmin API XML or JSON progress in real-time
I am working on implementing Virtualmins API system to my own control panel, although I am running in to an issue with XML/JSON.
Most of the API calls return success/failed, although when creating/deleting domains, the return seems to be a real-time progress report which I have no idea how to handle! The API call is made like this:
$result = shell_exec("wget -O - --quiet --http-user=12345 --http-passwd=12345 --no-check-certificate 'https://websiteexample.com:10000/virtual-server/remote.cgi?program=create-domain&parent=".$domain."&domain=".$subdomain."&desc=".$subdomain."&default-features=&xml=1&multiline='");
The result appears like this (when run directly via the URL in a browser):
<api command="create-domain" output="Beginning server creation .. Creating home directory .. .. done Adding records to DNS zone testsite.com .. .. done Adding to email domains list .. .. done Adding default mail aliases .. .. done Adding new virtual website .. .. done Performing other Apache configuration .. .. done Setting up scheduled Webalizer reporting .. .. done Setting up log file rotation .. .. done Creating MariaDB database example .. .. done Setting up spam filtering .. .. done Setting up virus filtering .. .. done Setting up AWstats reporting .. .. done Setting up password protection for AWstats .. .. done Saving server details .. .. done Re-starting DNS server .. .. done Applying web server configuration .. .. done Restarting PHP-FPM server .. .. done Updating Webmin user .. .. done Re-loading Webmin .. .. done All done! " status="success"/>
When run via the shell_exec
using the control panel, I get ERR_EMPTY_RESPONSE
and a blank browser? Even with PHP errors on. Ideally, it would be great to show the progress in real-time but I have no idea how to even execute this with that result without the browser throwing an error? Any ideas would be appreciated.
php
api
shell-exec
webmin
virtualmin
0 Answers
Your Answer