I am not sure, but pay attention at the format of CURLOPT_POSTFIELDS
parameters -> you send the parameters like array('name'=>'value'). You
are sending just a value.

On Aug 16, 11:06 am, Jing Hu <[email protected]> wrote:
> I got this problem when I attempt to retrieve the event list of the public
> calendar:
>
> {"apiVersion":"1.0","error":{"code":400,"message":"Invalid
> JSON","errors":[{"domain":"GData","code":"invalidJson","internalReason":"In 
> valid
> JSON"}]}}1
>
> I use cURL to POST the HTTP request.
>
> Here is my script:
>
> <?php
> $data  =
> array('alt'=>'json-in-script','callback'=>'insertAgenda','orderby'=>'startt 
> ime','max-results'=>'15','singleevents'=>'true','sortorder'=>'ascending','f 
> utureevents'=>'true');
> $json = json_encode($data);
> $header = array('Content-type: application/json');
> $url =
> "http://www.google.com/calendar/feeds/[email protected]/public/full";;
> $ch = curl_init();
> curl_setopt($ch,CURLOPT_URL,$url);
> curl_setopt($ch,CURLOPT_POSTFIELDS,$json);
> curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
> $result = curl_exec($ch);
> curl_close($ch);
> print_r(json_decode($result));
> ?>
>
> Is there any mistake with the JSON? or the problem is caused by other
> mistakes?
>
> thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Google Calendar Data 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://code.google.com/apis/calendar/community/forum.html

Reply via email to