Is manipulating Craigslist postings with PHP possible?
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 开发者_C百科will I also need to know how to use the cURL library?
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 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.
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.
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!
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.
精彩评论