The call to fwrite() is creating a 0-length file, because file_get_contents() is returning nothing... :bemused:
I'll keep trying!
BTW, the vB Code is wreaking havoc with that link. Here is the correct code snippet:
$contents = file_get_contents('http://stockcharts.com/def/servlet/SharpChartv05.ServletDriver?chart=$spx,uu[l,a]daclyyay[pb40!b200!d20,2][vc60][ilc20!la12,26,9!lb14]&r=1707');
$handle = fopen('/path/to/chart.png', 'wb');
fwrite($handle, $contents);
fclose($handle);
It's actually still a little off above. There's no space between '?' and 'chart.' Not that it matters much for the purposes of this discussion (it simply creates an incorrect chart).