views:

36

answers:

1

The troubleshooting page has some advice about GET, but nothing for POST.

Currently I am just taking away one post attribute at a time until it is no longer broken.

Is there a better way?

Hmm, the troubleshooting page recommends resubmitting a GET request with chof=validate or pasting into the Chart Playground - is there any quick way to convert GET to POST?

Is it as simple as tweaking this?

  $contextArray =  array("http" => array(
    "method" => "POST",
    "content" => http_build_query($chart, "", "&")));
+1  A: 

Here is a link for using POST with Google Charts: http://code.google.com/apis/chart/docs/post_requests.html

Not sure what you are wanting to do.

To send a post from PHP using $_GET[''] values you could add your values to the $data array and send it with the following function - or use CURL.

public function sendPostData($url, $data, $optional_headers = null)
    {
      $params = array('http' => array(
                  'method' => 'POST',
                  'content' => $data
                ));

      if ($optional_headers !== null) 
      {
        $params['http']['header'] = $optional_headers;
      }

      $ctx = stream_context_create($params);
      $fp = @fopen($url, 'rb', false, $ctx);
      if (!$fp) 
      {
        throw new Exception("Problem with $url, $php_errormsg");
      }

      $response = @stream_get_contents($fp);
      if ($response === false) 
      {
        throw new Exception("Problem reading data from $url, $php_errormsg");
      }

      return $response;
    }
Todd Moses