Gdata batch - lire la réponse
Bonjour
Via zend je désire réaliser des insertion/mises à jour dans mon calendrier via un batch chez Google.
J'utilise http://www.google.com/calendar/feeds...ate/full/batch pour envoyer mes données.
J'utilise un post pour envoyer mon code xml, l'insertion s'effectue bien dans mon calendrier
Code:
1 2 3 4 5 6 7
| try {
$response = $gdata->post($batchContent, $uri);
}
catch(Zend_Gdata_App_Exception $e) {
$error->error = 1;
echo $e->getMessage();
} |
J'ai un retour de google, je peux utiliser quelques fonctions par défaut tel que
Code:
1 2 3
| echo 'isError '.$response->isError().'<br />';
echo 'getStatus '.$response->getStatus().'<br />';
echo 'getMessage '.$response->getMessage().'<br />'; |
Par contre pas moyen d'accéder au reste de la réponse.
Le but est de pouvoir récupérer ligne pas ligne les id des évènements insérés par google.
J'ai trouvé la doc sur zend et celle chez google.
Mais le code de retour de google ne semble pas bien formaté. Je dois peut être utiliser une autre function que le post pour envoyer les données chez google ?
Et ci-dessous le retour de google.
Enfin je bloque.
Toute aide sera fortement appréciée.
Merci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
| <!--?xml version='1.0' encoding='UTF-8'?-->
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
<atom:id>
<a href="http://www.google.com/calendar/feeds/default/private/full/batch/1309761230127" target="_blank">http://www.google.com/calendar/feeds.../1309761230127</a>
</atom:id>
<atom:updated>
2011-07-04T06:33:50.572Z
</atom:updated>
<atom:category term="http://schemas.google.com/g/2005#event" scheme="http://schemas.google.com/g/2005#kind">
<atom:title type="text">
Batch Feed
</atom:title>
<atom:entry xmlns:gd="http://schemas.google.com/g/2005" xmlns:gcal="http://schemas.google.com/gCal/2005" xmlns:batch="http://schemas.google.com/gdata/batch">
<atom:id>
<a href="http://www.google.com/calendar/feeds/default/private/full/5dje0da3ni2om4lnklp7q4akfs" target="_blank">http://www.google.com/calendar/feeds...m4lnklp7q4akfs</a>
</atom:id>
<atom:published>
2011-07-04T06:33:50.000Z
</atom:published>
<atom:updated>
2011-07-04T06:33:50.000Z
</atom:updated>
<atom:category term="http://schemas.google.com/g/2005#event" scheme="http://schemas.google.com/g/2005#kind">
<atom:title type="text">
itemA
</atom:title>
<atom:content type="text">
...blah...
</atom:content>
<atom:link title="alternate" href="http://www.google.com/calendar/hosted/epfc.eu/event?eid=NWRqZTBkYTNuaTJvbTRsbmtscDdxNGFrZnMgYmVsZXRvdEBlcGZjLmV1" type="text/html" rel="alternate">
<atom:link href="http://www.google.com/calendar/feeds/default/private/full/5dje0da3ni2om4lnklp7q4akfs" type="application/atom+xml" rel="self">
<atom:link href="http://www.google.com/calendar/feeds/default/private/full/5dje0da3ni2om4lnklp7q4akfs/63445444430" type="application/atom+xml" rel="edit">
<atom:author>
<atom:name>
<a href="mailto:beletot@epfc.eu">beletot@epfc.eu</a>
</atom:name>
<atom:email>
<a href="mailto:beletot@epfc.eu">beletot@epfc.eu</a>
</atom:email>
</atom:author>
<gd:comments>
<gd:feedlink href="http://www.google.com/calendar/feeds/default/private/full/5dje0da3ni2om4lnklp7q4akfs/comments">
</gd:feedlink>
</gd:comments>
<gd:eventstatus value="http://schemas.google.com/g/2005#event.confirmed">
<gd:where valuestring="here">
<gd:who valuestring="beletot@epfc.eu" rel="http://schemas.google.com/g/2005#event.organizer" email="beletot@epfc.eu">
<gd:when starttime="2011-07-24T19:00:00.000+02:00" endtime="2011-07-25T21:00:00.000+02:00">
<gd:reminder minutes="10" method="email">
<gd:reminder minutes="10" method="alert">
</gd:reminder>
</gd:reminder>
</gd:when>
<gd:transparency value="http://schemas.google.com/g/2005#event.opaque">
<gd:visibility value="http://schemas.google.com/g/2005#event.default">
<gcal:anyonecanaddself value="false">
<batch:operation type="insert">
<batch:status reason="Created" code="201">
<gcal:guestscaninviteothers value="true">
<gcal:guestscanmodify value="false">
<gcal:guestscanseeguests value="true">
<gcal:sequence value="0">
<gcal:uid value="5dje0da3ni2om4lnklp7q4akfs@google.com">
</gcal:uid>
</gcal:sequence>
</gcal:guestscanseeguests>
</gcal:guestscanmodify>
</gcal:guestscaninviteothers>
</batch:status>
</batch:operation>
</gcal:anyonecanaddself>
</gd:visibility>
</gd:transparency>
</gd:who>
</gd:where>
</gd:eventstatus>
</atom:link>
</atom:link>
</atom:link>
</atom:category>
</atom:entry>
<atom:entry xmlns:gd="http://schemas.google.com/g/2005" xmlns:gcal="http://schemas.google.com/gCal/2005" xmlns:batch="http://schemas.google.com/gdata/batch">
<atom:id>
<a href="http://www.google.com/calendar/feeds/default/private/full/mtgqhvog2qnm8i224viq9up02g" target="_blank">http://www.google.com/calendar/feeds...8i224viq9up02g</a>
</atom:id>
<atom:published>
2011-07-04T06:33:50.000Z
</atom:published>
<atom:updated>
2011-07-04T06:33:50.000Z
</atom:updated>
<atom:category term="http://schemas.google.com/g/2005#event" scheme="http://schemas.google.com/g/2005#kind">
<atom:title type="text">
itemB
</atom:title>
<atom:content type="text">
...blah...
</atom:content>
<atom:link title="alternate" href="http://www.google.com/calendar/hosted/epfc.eu/event?eid=bXRncWh2b2cycW5tOGkyMjR2aXE5dXAwMmcgYmVsZXRvdEBlcGZjLmV1" type="text/html" rel="alternate">
<atom:link href="http://www.google.com/calendar/feeds/default/private/full/mtgqhvog2qnm8i224viq9up02g" type="application/atom+xml" rel="self">
<atom:link href="http://www.google.com/calendar/feeds/default/private/full/mtgqhvog2qnm8i224viq9up02g/63445444430" type="application/atom+xml" rel="edit">
<atom:author>
<atom:name>
<a href="mailto:beletot@epfc.eu">beletot@epfc.eu</a>
</atom:name>
<atom:email>
<a href="mailto:beletot@epfc.eu">beletot@epfc.eu</a>
</atom:email>
</atom:author>
<gd:comments>
<gd:feedlink href="http://www.google.com/calendar/feeds/default/private/full/mtgqhvog2qnm8i224viq9up02g/comments">
</gd:feedlink>
</gd:comments>
<gd:eventstatus value="http://schemas.google.com/g/2005#event.confirmed">
<gd:where valuestring="here">
<gd:who valuestring="beletot@epfc.eu" rel="http://schemas.google.com/g/2005#event.organizer" email="beletot@epfc.eu">
<gd:when starttime="2011-07-28T19:00:00.000+02:00" endtime="2011-07-28T21:00:00.000+02:00">
<gd:reminder minutes="10" method="email">
<gd:reminder minutes="10" method="alert">
</gd:reminder>
</gd:reminder>
</gd:when>
<gd:transparency value="http://schemas.google.com/g/2005#event.opaque">
<gd:visibility value="http://schemas.google.com/g/2005#event.default">
<gcal:anyonecanaddself value="false">
<batch:operation type="insert">
<batch:status reason="Created" code="201">
<gcal:guestscaninviteothers value="true">
<gcal:guestscanmodify value="false">
<gcal:guestscanseeguests value="true">
<gcal:sequence value="0">
<gcal:uid value="mtgqhvog2qnm8i224viq9up02g@google.com">
</gcal:uid>
</gcal:sequence>
</gcal:guestscanseeguests>
</gcal:guestscanmodify>
</gcal:guestscaninviteothers>
</batch:status>
</batch:operation>
</gcal:anyonecanaddself>
</gd:visibility>
</gd:transparency>
</gd:who>
</gd:where>
</gd:eventstatus>
</atom:link>
</atom:link>
</atom:link>
</atom:category>
</atom:entry>
</atom:category>
</atom:feed> |