是否可以使用 PHP 操作 Craigslist 帖子?
我想为自己构建一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我很确定 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).
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.
一些评论:
如果您想与外部服务交互(出于教育目的),可能类似于 Del.icio.us 可能会有更多用处。
祝你好运。
A few comments:
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.
对于可读性最强的英语,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!
我强烈建议您在追求时参考 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.