I am having this exact same problem. Using Google's example code verbatim and it does not work.
On Apr 10, 10:20 am, George <[email protected]> wrote: > I am trying to run the PHP Post request code on the bottom of this > page: > > http://code.google.com/apis/chart/docs/post_requests.html > > The image does not display in the browser and I am not sure how to > debug it. Any suggestions? > > The PHP code for a page I named ChartTest,php is below: > > <?php > // Create some random text-encoded data for a line chart. > header('content-type: image/png'); > $url = 'https://chart.googleapis.com/chart?chid='. > md5(uniqid(rand(), true)); > $chd = 't:'; > for ($i = 0; $i < 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' => 'lc', > 'chs' => '600x200', > 'chds' => '0,100000', > 'chd' => $chd); > > // Send the request, and print out the returned bytes. > $context = stream_context_create( > array( > 'http' => array( > 'method' => 'POST', > 'content' => http_build_query($chart), > 'header' => "Content-Type: application/x-www-form-urlencoded\r\n"))); > > fpassthru(fopen($url, 'r', false, $context)); > > ?> > > I am calling it from an html page as follows: > > <html> > > <img src="ChartTest.php"> > > </html> -- You received this message because you are subscribed to the Google Groups "Google Chart API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-chart-api?hl=en.
