Result Report XML

Good evening everyone,

I want to hand over a report in XML. This report should be stored on our own server.
For this purpose I created a PHP script that receives the data and then stores it accordingly.
The data can be read later on and processed.
Nevertheless, I get an error message when exporting. “Couldn’t send the report to:”

I´m not using google sheet
Is there something missing in my PHP code? At the moment there is no output in the script (echo …)
Does activePresenter Export expect any result string?
Or is there a need to user a special meta tag?

Here my Script
if (isset($_POST[“report”]))
{
//read report data
$report = $_POST[“report”];

$new = simplexml_load_string($report);
// Convert into json
$con = json_encode($new);

// Convert into associative array
$newArr = json_decode($con, true);

//process report, e.g. append to a text file here
$Descripton = $newArr[‘Report’][‘Description’];
$User = $newArr[‘Report’][‘UserID’];
$FileName=$Descripton."".$User."".date(“Ymd-His”).".xml";
$report_file = fopen($FileName, “a”);
if($report_file)
{
fwrite($report_file, $report);
//separate this report from others
fclose($report_file);
}
$response_array[‘result’] = ‘success’;
echo json_encode($response_array);
}

Many Thanks

Hi Jürgen,

ActivePresenter doesn’t require the server-side script to send any result.
Maybe you host the HTML5 output and the report script on different domains so the issue.

You should host them on the same domain, or enable cross-origin resource sharing for your report script so that it can be accessed by the HTML5 output.

For example, if the server where you host your script uses Apache, you can add a .htaccess file with the following content to the report script folder so that the script can be accessed by any domain/protocol:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

Regards

Hi Toan,

thanks for your reply

Good question. I stored the results on our webserver. Any result is stored in seperate file and can be read later and also used for checks, monitoring, eg.
So from the function (store results to a server, check data), everything works fine for me. The only point is the error message, which get the user, who made the test.

Hi Jürgen,

The HTML5 player doesn’t care where the results are stored, it just sends the report to the server-side script that handles the report.
If you host this script on a web server (e.g. at URL http://yourdomain.com/handle-report.php), then you need to host HTML5 output on that server too (e.g. at URL http://yourdomain.com/HTML5/tutorial.html)
Another method is configuring CORS as I mentioned in my previous answer.

Regards

Hi Toan,

thanks for your help. You brought me to the solution. The test was stored on the same webserver, but differenz domain (test.domain for the user, results.domain for storing).
I changed it to the same domain and it worked.

Crazy, that the stored still worked.

can the topic closed somehow?

Due to security reasons, cross-domain requests like this will be blocked by default.
I’m not sure why the error only occurs at the client side, while the server can still handle the request.
Anyway, you should place them on the same domain or configure CORS to ensure it works properly.
For more information, you can see these pages:

Yes, we can close this topic here.

Regards