Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 876685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:28:22+00:00 2026-05-15T11:28:22+00:00

I am using the php post request example given on http://code.google.com/apis/chart/docs/post_requests.html for generating chart.

  • 0

I am using the php post request example given on http://code.google.com/apis/chart/docs/post_requests.html for generating chart.

The code:
chartserver-image.php

<?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 < 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))));
fpassthru(fopen($url, 'r', false, $context));
?>

another_page.html

<img width='600' height='200' src='chartserver-image.php'>

Right now when i access another_page.html, the image doesn’t load when i click on view image it shows

The image “http://localhost/demo/chartserver-image.php” cannot be displayed, because it contains errors.

What is the issue i am unable to understand?

Please help me on this

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:28:23+00:00Added an answer on May 15, 2026 at 11:28 am

    Replacing ‘content’ => http_build_query($chart)))); with ‘content’ => http_build_query($chart,”, ‘&’)))); resolves the issue.

    I have added arg separator ‘&’ to http_build_query() which avoid bug if the
    arg_separator.output parameter is modified in php.ini.

    When i checked phpinfo the arg_separator.output was &amp. That was causing issue so adding ‘&’ to http_build_query() resolves the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
I just tried using the example given on developers.facebook.com to open a request form
I'm using the jQuery Tag-It script, can be viewed here: http://levycarneiro.com/projects/tag-it/example.html The script originally
I am using PHP to perform a POST request from a socket. Here is
My task is simple: make a post request to translate.google.com and get the translation.
I am using Graph API https://developers.facebook.com/docs/reference/api/#publishing with PHP SDK and I would like to
I'm posting a request with POST data using cURL to a PHP script here:
I'm using PHP and AJAX to make a post in a page. Below is
How can I do a RAW POST in PHP using cURL? Raw post as
I would like make a script using PHP (probably need JS) to send POST

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.