I need to get images from Google Chart, but I’m behind a proxy.
With the code below (changing $url) I can get images from other sites, but not from google:
$url =
‘http://chart.apis.google.com/chart?chs=450×270&chd=t:’.$values_list.’&cht=p&chl=’.$labels_list.’&chco=80AF1B,FFFF8C&chf=bg,s,F8F8F8′;
$img = '../uploads/tx_oriindicadores/triglo.png';
file_put_contents($img, t3lib_div::getURL($url));
The code of the getURL() method uses cURL functions to connect and retrieve data.
At this moment I only get an empty file.
Are there some parameters or configuraton that I care in order to get images from google?
Thanks.
The getURL() method is native of TYPO3 and you can see the code in this page:
http://doc-typo3.ameos.com/4.1.0/class_8t3lib__div_8php-source.html Line 2342
I pass the parameters through the backend of the site.
The function above is right, the problem was that in the variable
$labels_listthere were spaces. So replacing the spaces with%20solved the problem.The spaces in the direct URL request are not a problem, but in cURL there are.
So as general rule don’t use spaces when work with cURL, use instead
%20.