我需要一些帮助来解决这个问题,拜托。这几天我一直在尝试。
检索提要并解析它们并不是真正的问题,但是以 xml 的形式上传数据是?
下面的代码也部分来自谷歌文档示例代码,但显然它不起作用。
我希望其他人更多地进入谷歌 api 工作,因为我不知道。目前,我只是尝试为相册中的照片添加标签。一旦可行,我可能也可以完成其余的工作。
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;
谢谢,有钱