I've just found the difference: 
http://helpmenow.dalibor-sojic.info/test/difference.png
(graph.txt is actualy graph.png).

So... the difference is "\r\n" I think... and I wonder why it is
there.

On Sep 5, 3:45 pm, Dalibor Sojic <[email protected]> wrote:
> Here is the code:
>
> Function:
>                 $ch = curl_init('http://chart.apis.google.com/chart?
> chid='.md5(uniqid(rand(), true)).'&'.http_build_query($this->_post));
>                 curl_setopt($ch, CURLOPT_HEADER, 0);
>                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>                 curl_setopt($ch,CURLOPT_POST,count($this->_post));
>                 
> curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($this->_post));
>                 $response = curl_exec($ch);
>
>         $file = fopen('/path/to/test/graph.png', 'w+');
>
>         fwrite($file, $response);
>
>         fclose($file);
>
>         return $response;
>
> In main .php I have:
>
>                 header('Content-Type: image/png');
>                 echo $chart;
>
> As you can see... I save the response into .png 
> filehttp://helpmenow.dalibor-sojic.info/test/graph.pngcalled 
> byhttp://helpmenow.dalibor-sojic.info/adsl/graph
>
> Saved response into .png image is working, but... "dynamically"
> generated is not working.
>
> Here is the difference between headers in both cases:
>
> Workinghttp://helpmenow.dalibor-sojic.info/test/graph.png
>         HTTP/1.1 200 OK
>         Date: Sun, 05 Sep 2010 13:35:06 GMT
>         Server: Apache
>         Last-Modified: Sun, 05 Sep 2010 13:34:55 GMT
>         Accept-Ranges: bytes
>         Content-Length: 1845
>         Expires: Thu, 15 Apr 2011 20:00:00 GMT
>         Connection: close
>         Content-Type: image/png
>
> Non workinghttp://helpmenow.dalibor-sojic.info/adsl/graph
>         HTTP/1.1 200 OK
>         Date: Sun, 05 Sep 2010 13:35:07 GMT
>         Server: Apache
>         X-Powered-By: PHP/5.3.2
>         Content-Length: 1847
>         Connection: close
>         Content-Type: image/png
>
> As you can see... the main difference is Content-Length
>
> Dynamically generated png is 2 bytes longer
>
> I've tried with "trim($response)" but... nothing happened.
>
> Any hint?
>
> On Aug 22, 12:41 am, Dalibor Sojic <[email protected]> wrote:
>
>
>
> > Yes, I have tried. The request is valid.
>
> > It is not problem with request.... I get PNG response, but.... the
> > browser can not "render" it.
>
> > On Aug 20, 8:04 pm, John Pettitt <[email protected]> wrote:
>
> > > have you tried adding chof=validate and seeing what error is triggering 
> > > the problem?
>
> > > On Aug 20, 2010, at 10:59 AM, Dalibor Sojic wrote:
>
> > > > Any hint?
>
> > > > On Aug 18, 3:47 pm, Dalibor Sojic <[email protected]> wrote:
> > > >>http://helpmenow.dalibor-sojic.info/adsl/graph
>
> > > >> This is with
>
> > > >> $context = stream_context_create(
> > > >>     array('http' => array(
> > > >>      'method' => 'POST',
> > > >>       'content' => http_build_query($this->_post),
> > > >>         'header' => "Content-Type: application/x-www-form-urlencoded\r
> > > >> \n")));
> > > >>   fpassthru(fopen('http://chart.apis.google.com/chart', 'r', false,
> > > >> $context));
>
> > > >> ---------- Forwarded message ----------
> > > >> From: Rémi Lanvin <[email protected]>
> > > >> Date: Aug 18, 3:11 pm
> > > >> Subject: Chart over php (curl or fpassthru)
> > > >> To: Google Chart API
>
> > > >> 2010/8/18 Dalibor Sojic <[email protected]>:
>
> > > >>> I'm trying to use google chart sending post parametars, but always get
> > > >>> image: The image “URL” cannot be displayed, because it contains
> > > >>> errors.
>
> > > >> Hello,
>
> > > >> Remove the header that sets the content-type to image/png and you'll
> > > >> be able to see the errors/warnings triggered by PHP.
>
> > > >> --
> > > >> Rémihttp://googlechartphplib.cloudconnected.fr/
>
> > > > --
> > > > 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 
> > > > athttp://groups.google.com/group/google-chart-api?hl=en.

-- 
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.

Reply via email to