title: Google Chart Tool Example Not Working
body: <p>I am using the php post request example given on <a href="http://code.google.com/apis/chart/docs/post_requests.html" rel="nofollow noreferrer">http://code.google.com/apis/chart/docs/post_requests.html</a> for generating chart.</p>
  
  <p>The code:
  chartserver-image.php</p>
  
  <pre><code>&lt;?php
   // Create some random text-encoded data for a line chart.
   header('content-type: image/png');
   $url = 'http://chart.apis.google.com/chart';
   $chd = 't:';
   for ($i = 0; $i &lt; 150; ++$i) {
   $data = rand(0, 100000);
   $chd .= $data . ',';
   }
   $chd = substr($chd, 0, -1);
  
  // Add data, chart type, chart size, and scale to params.
  $chart = array(
  'cht' =&gt; 'lc',
  'chs' =&gt; '600x200',
  'chds' =&gt; '0,100000',
  'chd' =&gt; $chd);
  
  // Send the request, and print out the returned bytes.
  $context = stream_context_create(
  array('http' =&gt; array(
    'method' =&gt; 'POST',
    'content' =&gt; http_build_query($chart))));
  fpassthru(fopen($url, 'r', false, $context));
  ?&gt;
  </code></pre>
  
  <p>another_page.html</p>
  
  <pre><code>&lt;img width='600' height='200' src='chartserver-image.php'&gt;
  </code></pre>
  
  <p>Right now when i access another_page.html, the image doesn't load when i click on view image it shows </p>
  
  <p>The image “<a href="http://localhost/demo/chartserver-image.php" rel="nofollow noreferrer">http://localhost/demo/chartserver-image.php</a>” cannot be displayed, because it contains errors.</p>
  
  <p>What is the issue i am unable to understand?</p>
  
  <p>Please help me on this</p>
  
  <p>Thanks</p>