是否可以使用 PHP 操作 Craigslist 帖子?

发布于 2024-09-03 18:40:54 字数 165 浏览 9 评论 0原文

我想为自己构建一个 Web 应用程序,允许我将内容发布到 Craigslist 并从 Craigslist 检索帖子。我这样做并不是为了向 Craigslist 发送垃圾邮件,我这样做只是为了学习。

我的问题是:这可能吗?如果是这样,了解 PHP 就足够了吗?或者我还需要知道如何使用 cURL 库?

I want to build a web app for myself that will allow me to post stuff to Craigslist and retrieve postings from Craigslists. I am not doing this to spam Craigslist, I am just doing it to learn.

My question is: Is this possible? If so, will knowing PHP be enough? Or will I also need to know how to use the cURL library?

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

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

发布评论

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

评论(5

风渺 2024-09-10 18:40:54

我很确定 Craigslist 看不起抓取工具

如果您的主机允许,您将需要使用 cURL 或 file_get_contents()

然而,cURL 会更容易,因为您不必处理 POST 内容的上下文。

如果您只是想学习并且不想陷入麻烦(法律或道德),请在您获得网站所有者许可的情况下抓取网站。或者更简单的是,创建您自己的网站,然后自己抓取它(通过 HTTP)。

I'm pretty sure Craigslist looks down on scrapers.

You will need to use cURL, or file_get_contents() if your host allows it.

cURL will be easier however, as you won't have to deal with context for POST stuff.

If you just want to learn and don't want to get into trouble (legal or ethical), scrape a site where you have permission of the site's owner. Or even easier, make your own site and then scrape it yourself (via HTTP).

就像说晚安 2024-09-10 18:40:54

PHP 本身只是一种语言。正是各种模块使它变得有用。这确实包括 cURL 模块。所以,是的,您还需要了解 cURL。

PHP itself is just a language. It's the various modules that make it useful. This does include the cURL module. So yes, you'll need to know cURL as well.

鸠魁 2024-09-10 18:40:54

一些评论:

  • SO 上有一些与访问 Craigslist 相关的帖子。如果你还没有的话,我会检查一下。
  • 我不相信 Craigslist 有官方 API。这意味着您的练习可能违反他们的一些使用条款。请先确保并通读该内容。
  • 如果您决定尝试与他们的服务交互,则不需要 PHP。选择你的毒药:PHP、ASP、CFM、Perl、.NET(任何风格)、Java 等。cURL
  • 与 PHP 一样,只是与外部服务交互的一种方法。根据 API,您可以期望某些语言拥有自己的交互库(例如 SOAP、XML-RPC、AMF、Restful HTTP 等)。

如果您想与外部服务交互(出于教育目的),可能类似于 Del.icio.us 可能会有更多用处。

祝你好运。

A few comments:

  • There are a few posts relevant to accessing Craigslist on SO. I'd check those out if you haven't already.
  • I don't believe Craigslist has an official API. That would mean your exercises may violate some of their terms of use. Make sure and read through that first.
  • PHP isn't a requirement, if you decide to try interacting with their service. Pick your poison: PHP, ASP, CFM, Perl, .NET (any flavor), Java, etc.
  • cURL, like PHP, is only one method of interacting with an external service. Depending on the API, you can expect some languages to have their own libraries for interaction (e.g. SOAP, XML-RPC, AMF, Restful HTTP, etc.).

If you're looking to interact with an external service (for educational purposes) maybe something like Del.icio.us may be of more use.

Good luck.

很酷不放纵 2024-09-10 18:40:54

对于可读性最强的英语,Craigslist 很可能不允许您从您的应用程序那里发帖,除非他们给予您这样做的“特权”。

关于您关于完成类似任务所需知识的问题:

是的,可以仅使用 php 从一个应用程序发布到另一个应用程序!

For a most readable English, Craigslist most likely does NOT allows you to post from your app there, unless they give you "privileges" to do so.

Regarding your question about the necessary knowledge to accomplish something like that:

Yes, it's possible to post from one app to another just using php!

╰つ倒转 2024-09-10 18:40:54

我强烈建议您在追求时参考 Craiglickr 。虽然我无意帮助您将其移植到 PHP,但它是我个人所知道的唯一与 Cragslist 有关的开源工具。简短的回答:是的,在 PHP 中是可能的。不,这并不容易。而且,PHP 缺乏事件驱动的框架将使其特别具有挑战性。

I would highly suggest you reference Craiglickr in your pursuit. While I have no desire to help you port it to PHP, it is the only open source tool that I personally know of that has anything to do with Cragslist. The short answer: yes, it is possible in PHP. No it won't be easy. And, PHP's lack of an event-driven framework will make it especially challenging.

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