the specific issue I am working on is enabling https with Google charts API, and a possible character limit when using php file_get_contents on a url string. Let me take you through what is going on. I have made good progress using some tutorials on the net, specifically to enable the https. I am using their 'basic method' from this tutorial:
http://webguru.org/2009/11/09/php/how-to-use-google-charts-api-in-your-secure-https-webpage/
I have a chart.php file with this code in it:
<?php
$url = urldecode($_GET['api_url']);
$image_contents = file_get_contents($url);
echo $image_contents;
exit;
?>
I am calling this file from my main page, passing a 'test' Google chart URL (I have used many different ones) to it, which is 513 chars long:
$chartUrl = urlencode('http://chart.apis.google.com/chart?chxl=0:|Jan|Feb|Mar|Jun|Jul|Aug|1:|100|75|50|25|0&chxt=x,y&chs=300x150&cht=lc&chd=t:60.037,57.869,56.39,51.408,42.773,39.38,38.494,31.165,30.397,26.876,23.841,20.253,16.232,13.417,12.677,15.248,16.244,13.434,10.331,10.58,9.738,10.717,11.282,10.758,10.083,17.299,6.142,19.044,7.331,8.898,14.494,17.054,16.546,13.559,13.892,12.541,16.004,20.026,18.529,20.265,23.13,27.584,28.966,31.691,36.72,40.083,41.538,42.788,42.322,43.593,44.326,46.152,46.312,47.454&chg=25,25&chls=0.75,-1,-1');
To display the image in my main page I am using this code:
<img src="https://mysite.com/chart.php?api_url=<?php echo $chartUrl; ?>" />
The example $chartUrl string should display nothing. It will work fine until the $chartUrl string exceeds 512 characters in length (unencoded). For example if you use this string below (512 chars long):
$chartUrl = urlencode('http://chart.apis.google.com/chart?chxl=0:|Jan|Feb|Mar|Jun|Jul|Aug|1:|100|75|50|25|0&chxt=x,y&chs=300x150&cht=lc&chd=t:60.037,57.869,56.39,51.408,42.773,39.38,38.494,31.165,30.397,26.876,23.841,20.253,16.232,13.417,12.677,15.248,16.244,13.434,10.331,10.58,9.738,10.717,11.282,10.758,10.083,17.299,6.142,19.044,7.331,8.898,14.494,17.054,16.546,13.559,13.892,12.54,16.004,20.026,18.529,20.265,23.13,27.584,28.966,31.691,36.72,40.083,41.538,42.788,42.322,43.593,44.326,46.152,46.312,47.454&chg=25,25&chls=0.75,-1,-1');
The chart should show up. The difference between the strings is one character. The 'real' Google chart API string that I will be using in the final version is about 1250 chars long.
So is this a limit on get_file_contents()? I have looked at cURL as an alternative, but its specifics go over my head. Can someone confirm the char limit, and if possible make some suggestions?
Many thanks, Neil