Page 1 of 1

Slow connection from apache to cumulus MX server

Posted: Wed 07 Sep 2022 6:57 pm
by Atlas
Hi

I have Cumulus MX and my website webserver on the same PC and I have been using a PHP script with file_get_contents catching http://127.0.0.1:8998/api/data/currentdata to feed my web site gauges page but in the latest MX versions the response is very slow, around 15 secs to get the data.
Directly in the browser there is no problem but with file_get_contents with php and apache in the same PC there is that 15 secs delay.

With previous MX versions (3017 for example) didn't happen that problem.

I know that MX uses a C library called EmbedIO to create its web server.

Some hints to know how to fix the problem ?? I have been trying to change http headers in the file_get_contents petition with no success. Something has changed in the MX server ??

Thanks

Re: Slow connection from apache to cumulus MX server

Posted: Thu 08 Sep 2022 8:17 am
by mcrossley
Something may have changed in EmbedIO, but nothing in CMX.

A quick search found this which *sounds* relevant even though it is old... https://stackoverflow.com/questions/362 ... g-full-url

Re: Slow connection from apache to cumulus MX server

Posted: Thu 08 Sep 2022 9:23 am
by Atlas
Thanks for answering

Searching for answers on google I reached the same link with no success

I've put curl and problem fixed

Code: Select all


<?php

header("Content-Type: text/plain");

$url = 'http://127.0.0.1:8998/api/data/currentdata';
 
$curl = curl_init();
 
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 
$data = curl_exec($curl);
 
curl_close($curl);

echo $data;

?>

https://www.meteoarchena.es/gauges.html

Hope that it helps someone.