stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

error code: 1006

I am troubleshooting an app which makes use of highcharts. I just took over this code so my apologies if I have missed something obvious.

Our server is reaching out to highcharts via php curl_exec to URL: https://export.highcharts.com/?async=tr ... 0&options=...

Followed by the JSON for the chart. If I paste and test the JSON in https://export.highcharts.com/ it works.

The result I am getting via curl is "error code: 1006". This code was working before Dec 12th.

Specific php snippit:

Code: Select all

$DataEncoded = json_encode($chartArray);
            $dataString = ('async=true&type=image/png&height=300&options=' . $DataEncoded);
            $url = 'https://export.highcharts.com/?';
            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
            curl_setopt($ch, CURLOPT_POST, 1);

            $headers = array();
            $headers[] = "Accept: application/json";
            $headers[] = "Content-Type: application/x-www-form-urlencoded";
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            $result = curl_exec($ch);
            curl_close($ch);
Thanks for any help. Even pointing me in the direction of an error codes document would be helpful.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Hi stephenblender,

Welcome to our forum and thanks for contacting us with your issue!

It is highly probable that this code doesn't work anymore due to recently introduced changes. The async option is no longer supported.
You can read more about it here: https://www.highcharts.com/docs/export- ... ync-option
You will find there a migration guide.

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

Thanks for the quick reply!
The timing suggests this must be related - our first chart after December 1st was on the 12th, and failed. BUT - I tried to implement the sample code, then cut and pasted the sample code, without success ... same error. 'curl_error' is empty and the reply from highcharts is still "error code: 1006".
One thought - the author of our original code thought it was correct to re-request on failure...infinitely I suppose limited by the server timeout. Is it possible we have exceeded some usage limit?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

stephenblender,

Export server has rate limiting set and allows you to make up to 10 request within one minute. You can read more about it here:
https://www.highcharts.com/docs/export- ... mer-export

However, I don't think this is the cause of error 1006. I will pass this question to our export server expert and he will answer it asap.

Thanks for your patience.
Regards!
Mateusz Bernacik
Highcharts Developer
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Hi stephenblender,

Could you try to create a direct curl request without using PHP? For example

Code: Select all

curl -H "Content-Type: application/json" -X POST -d '{"infile": {"series": [{"data": [29.9, 71.5, 106.4]}]}}' 127.0.0.1:7801 -o curl.png
Please try something like that and let me know if it worked. If not, please share the error.

Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

Done, action and result below. But it looks like this is just curl'ing my own server.

Code: Select all

ubuntu@ip-172-26-13-241:~$ curl -H "Content-Type: application/json" -X POST -d '{"infile": {"series": [{"data": [29.9, 71.
5, 106.4]}]}}' 127.0.0.1:7801 -o curl.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 por
t 7801: Connection refused
Just in case I did the same with the highcharts export url:

Code: Select all

ubuntu@ip-172-26-13-241:~$ curl -H "Content-Type: application/json" -X POST -d '{"infile": {"series": [{"data": [29.9, 71.
> 5, 106.4]}]}}' https://export.highcharts.com/ -o curl.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    72  100    16  100    56    115    403 --:--:-- --:--:-- --:--:--   405
ubuntu@ip-172-26-13-241:~$ 
These were done via the console (AWS) and the actual server app code is in a plesk installation on said server...not sure if the plesk supported services have different limitations than the server itself.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Thanks for trying that.

Just one more thing. Could you try running this request? It wors fine for me, export server returns a chart.

Code: Select all

curl -H "Content-Type: application/json" -X POST -d '{"infile": {"series": [{"data": [29.9, 71.5, 106.4]}]}}' https://export.highcharts.com/ -o curl.png
Please check thoroughly after the request if the file was created in the directory from which the command was executed.

Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

I can't say for certain it is a chart, but the file curl.png appeared where I executed. I think this was my second test yesterday...although it never occurred to me to confirm the received file!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

If you have an access to that file then please open it and check if the chart is generated correctly. If so, then it seems like there might be a problem with you PHP code rather than with out export server.

Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

Thanks for your help. Chart is received correct as intended. Regarding the code, I have cut and pasted your sample code to try and verify the functionality. (included below) Or do you mean something outside your sample that is limiting it somehow? Keeping in mind we were curl'ing without issues before Dec 1st.

Code: Select all

            $type = 'png'; // Can be png, jpeg or pdf
            // Chart options
            $options = [
                'series' => [[
                    'data' => [1, 4, 3, 5],
                    'type' => 'column'
                ]]
            ];
            $arr = [
                'type' => $type,
                'width' => 400,
                'infile' => $options
            ];
            $data = json_encode($arr);
            $curlProcess = curl_init();
            curl_setopt( $curlProcess, CURLOPT_URL, 'https://export.highcharts.com/' );
            curl_setopt(
                $curlProcess,
                CURLOPT_HTTPHEADER,
                array(
                    'Content-Type: application/json',
                    'Content-Length: ' . strlen( $data ), 'Accept: application/json'
                )
            );
            curl_setopt( $curlProcess, CURLOPT_HEADER, 0 );
            curl_setopt( $curlProcess, CURLOPT_TIMEOUT, 30 );
            curl_setopt( $curlProcess, CURLOPT_POST, 1 );
            curl_setopt( $curlProcess, CURLOPT_POSTFIELDS, $data );
            curl_setopt( $curlProcess, CURLOPT_RETURNTRANSFER, TRUE );
            curl_setopt($curlProcess, CURLOPT_USERAGENT, 'User-Agent: curl/7.39.0');
            $content = curl_exec( $curlProcess );
            $this->logit("curl error:".curl_error($curlProcess));
            curl_close( $curlProcess );
            //file_put_contents("chart.$type", $content);

            $this->logit("CURL RESULT:".print_r($content,true));
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Hi stephenblender,

I started thinking that you might have been banned by cloudflare. It makes perfect sense because of infinite requests and the error context, but I need to consult with our export server expert to be sure. I will get back to you with answer asap.

Thanks for your patience.
Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

Thanks for looking into this. I just did a fresh test in case the problem had cleared itself up, say after a period of zero requests. No luck, still 1006.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Hi stephenblender,

While we are still investigating the problem, could you try to run exactly the same script / request from other machine with different IP? If it would work then it means that almost for sure you have been banned for too many requests.

Regards!
Mateusz Bernacik
Highcharts Developer
stephenblender
Posts: 9
Joined: Tue Dec 21, 2021 5:20 pm

Re: error code: 1006

Good idea, funny / interesting result. I ran the sample code on 2 different servers which had a different result, but still an error. In these cases the error was 1010. One was a similarly configured AWS but different IP, the other not aws.

So 1006 could be cloudflare ban, and 1010 could be:
Error 1010: The owner of this website has banned your access based on your browser's signature
Common cause
A website owner blocked your request based on your client's web browser.

Resolution
Notify the website owner of the blocking. If you cannot determine how to contact the website owner, lookup contact information for the domain via the Whois database. Site owners disable Browser Integrity Check via the Settings tab of the Firewall app.

https://support.cloudflare.com/hc/en-us ... XXX-errors
Again I am using the Highchart sample code quoted earlier.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: error code: 1006

Hi stephenblender,

Just wanted to let you know that I have contacted our export server expert and will get back to you with answer shortly.

Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”