J'ai besoin d'aide avec ce problème, s'il vous plaît. Depuis des jours, j'ai essayé maintenant.php télécharger xml to google api
La récupération des flux et leur analyse n'est pas vraiment un problème, mais Téléchargement de données dans le formulaire hors xml est?
Le code ci-dessous est partiellement issu du google docs samplecode également, mais de toute évidence, il ne fonctionne pas.
J'espère que quelqu'un d'autre est plus dans le fonctionnement de Google API, parce que je ne sais pas. Actuellement, j'essaie seulement d'ajouter un tag à une photo dans un album. Une fois que cela fonctionne, je peux probablement faire le reste aussi.
public function postTag() {
$query='smarty';
$this->updateOptie('tag', $query);
$feedUrl = $this->creeerFeedUrl('myalbum', false);
$picasa = $this->parseFeed($feedUrl);
$gphoto = $picasa['gphoto'][0];
$gphotoid = $gphoto['id'];
//return $gphotoid;
////////////////////sofar no problem//////////////////
$tag = "mytag";
$data = "<entry xmlns='http://www.w3.org/2005/Atom'>
<title>$tag</title>
<category scheme=\"http://schemas.google.com/g/2005#kind\" term=\"http://schemas.google.com/photos/2007#tag\"/>
</entry>";
$albumid = 'myalbum';
$itemsFeedURL = $this->krijgPicasaBasisUrl(). "/albumid/$albumid/photoid/$gphotoid";
$len=strlen($data);
$headers = array(
"Authorization: GoogleLogin auth=" . $this->auth,
"GData-Version: 2",
'Content-Type: application/atom+xml',
"Content-Length: $len",
);
$ch = curl_init(); /* Create a CURL handle. */
/* Set cURL options. */
curl_setopt($ch, CURLOPT_URL, $itemsFeedURL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
$result = curl_exec($ch); /* Execute the HTTP request. */
$info = curl_getinfo($ch);
curl_close($ch); /* Close the cURL handle. */
return $info;
grâce, riche
Votre devis ne fonctionne pas correctement lorsque vous affectez '$ data' - est-ce seulement sur SO ou dans votre source? –