使用 Zend Gdata API 在 Google Base 中插入项目后如何获取唯一的 URL 标识符?

发布于 2024-08-02 12:10:42 字数 271 浏览 2 评论 0原文

我需要获取使用 Zend_Gdata_Gbase 库将项目插入 Google Base 后创建的产品的唯一 URL 标识符。

我似乎无法做到这一点。我发现网上关于操作这些应用程序中使用的对象的文档惊人地缺乏。

我添加到对象的 url 无法在以后检索基本项目,这就是为什么我需要获取 google 在提交时生成的 URL。

我正在编写一个程序,需要能够在以后删除内容,因此需要存储该信息以使网站与 Google Base feed 保持同步。

预先感谢您的任何帮助。

I need to get the unique URL identifier for the product that is created after inserting an item into Google Base using the Zend_Gdata_Gbase library.

I can't seem to do this. I am finding a startling lack of documentation online about manipulating the objects used in these applications.

The url that I add to the object does not work to retrieve the base item later, which is why I need to get the one that google generates upon submission.

I am writing a program that will need to be able to delete content at a later date, and thus will need to store that information in order to keep the website synced with the Google Base feed.

Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乄_柒ぐ汐 2024-08-09 12:10:42

答案是......创建新条目后,您运行代码来插入条目。

$dryRun = false;
$createdEntry = $service->insertGbaseItem($newEntry, $dryRun);

$http = $createdEntry->service->getHttpClient();
$headers = $http->getLastResponse()->getHeaders();
return $headers['Location'];

这将为您提供与可作为链接插入的 URL 不同的唯一 URL。如果您不插入自己的链接,则可以更轻松地访问唯一的网址:

return $createdEntry->link[0]->href;

我希望这对其他人有帮助。

The answer is... after having created the new entry, you run the code to insert the entry.

$dryRun = false;
$createdEntry = $service->insertGbaseItem($newEntry, $dryRun);

$http = $createdEntry->service->getHttpClient();
$headers = $http->getLastResponse()->getHeaders();
return $headers['Location'];

This gives you the unique URL that is different from the URL you can insert as a link. If you aren't inserting your own links, you can access the unique url much more easily:

return $createdEntry->link[0]->href;

I hope this helps somebody else.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文