Html data grabber

Does someone have an example of using the Analytics App to poll an IOT webserver and get multiple characteristics in one Array of data?

I have a Solar inverter with a web interface that outputs one javascript string:

var version=“H4.01…";var webData=“string-part1,string-part2,string-part3,string-part4,1500,42,37,66841,56,”;function initPageText(.)function init_webdata_form(){var E=webData;var B=”“;var A,C,D;A=E.length;C=0;D=0;while(C<A){if(E.charAt(C)==”,“){C+=1;D+=1;web_data_show(D,B);B=”"}else{B=B+E.charAt(C);C+=1}}}function web_data_show(D,A){var C=new Array(“webdata_sn”,“webdata_msvn”,“webdata_ssvn”,“webdata_pv_type”,“webdata_rate_p”,“webdata_now_p”,“webdata_today_e”,“webdata_total_e”,“webdata_alarm”,“webdata_utime”);if(D>10||D<=0){return}(.*)else{alert(C[D])}};

With a bit of study on the delivered example (the Amazon book rank) I figured out this regex:

/(^.*;var webData=“)(?<Array>)(”.*var C=new Array\()(?<Dimension>)(\(.*)/

to get the bold parts in the sample, the first string (without the quotes) as an array, the second part as dimensions for this array.

When I run the test with this regex I receive an Error: count(): Argument #1 ($value) must be of type Countable|array, null given

Any help is appreciated.

I am using PHP8 and found this error here as well: php - count(): Argument #1 ($value) must be of type Countable|array, null given - Stack Overflow

There the error seems to be related to variable case-sensitivity. In the Analytics app in the settings for the data grabber I also see examples with capitals in the set variables.

So: is this thrown error related to using capitals in the regex for Array and Dimension?

Use https://regex101.com/ to test your regex; make sure you use the proper PHP version.