Closed elteto closed 6 years ago
@elteto There are several things to correct in your php code.
Below is your modified PHP code which was tested and works well:
<?php
$fh = fopen('filename.jpg', 'w+');
$data = "responseType=file&dataType=script&data=var chart = anychart.line([1,2,5]); chart.container('container'); chart.draw()";
$headers = array('Accept: application/json');
$defaults = array(
CURLOPT_URL=>'http://localhost:3000/jpg',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER=> $headers,
CURLOPT_FILE=> $fh
);
$ch = curl_init();
curl_setopt_array($ch, $defaults);
$picture = curl_exec($ch);
curl_close($ch);
fwrite($fh, $picture);
fclose($fh);
?>
It works! Thanks!
I receive the following error when executing the following code in php
This is my code using the sample in (https://docs.anychart.com/Common_Settings/Server-side_Rendering)
when i run in console, with curl, its Ok. but from php give an error.