php Craigslist 自动发布 API?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3633830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Craigslist Automated Posting API?
提问by same
i was looking through craigslist bulk posting section and it requires an rss feed to be sent to a server to automatically post an add the site is found at
我正在浏览 craigslist 批量发布部分,它需要将 RSS 提要发送到服务器以自动发布添加该站点的站点
http://www.craigslist.org/about/bulk_posting_interface
http://www.craigslist.org/about/bulk_posting_interface
i have looked up and down for a sample of a php class but cannot find out. anyone know of any class that exists? thanks
我已经上下查找了一个 php 类的示例,但找不到。任何人都知道存在的任何类?谢谢
回答by Raju
I just checked the CL's terms of use and it explicitly mentions any automated posting to be illegal. So, if it is a generic commercial idea you wish to scale up, note that:
我刚刚检查了 CL 的使用条款,它明确提到任何自动发布都是非法的。因此,如果这是您希望扩大规模的通用商业创意,请注意:
It is expressly prohibited to post content to craigslist using any automated means. Users must post all content personally and manually through all steps of the posting process. It is also expressly prohibited for any user to develop, offer, market, sell, distribute or provide an automated means to perform any step of the posting process (in whole or in part). Any user who develops, offers, markets, sells, distributes or provides an automated means to perform any step of the posting process (in whole or in part) shall be responsible and liable to CL for each instance of access to craigslist (by any user or other third party) using that automated means.
明确禁止使用任何自动化方式将内容发布到 craigslist。用户必须通过发布过程的所有步骤亲自和手动发布所有内容。还明确禁止任何用户开发、提供、营销、销售、分发或提供自动化方式来执行发布过程的任何步骤(全部或部分)。任何开发、提供、营销、销售、分发或提供自动方式来执行发布过程的任何步骤(全部或部分)的任何用户都应对 CL 负责并承担每次访问 craigslist 的责任(由任何用户或其他第三方)使用该自动化方式。
回答by Luke Stevenson
I have searched around for this for you, and have found the same results - At this time, there does not appear to be any existing, freely-available PHP classes to handle Craigslist Bulk Uploads.
我已经为你搜索了这个,并找到了相同的结果 - 目前,似乎没有任何现有的、免费可用的 PHP 类来处理 Craigslist 批量上传。
I have also found that others, searching for the same, have resorted to posting jobs on freelancing boards like Freelancer.comto engage developers to create one for them.
我还发现其他人在寻找相同的东西时,已经求助于在Freelancer.com等自由职业者板上发布工作,以吸引开发人员为他们创建一个。
Looks like you will have to write this code yourself, or pay someone to do it for you. Sorry.
看起来您必须自己编写此代码,或者花钱请人为您编写。对不起。
APPENDUM:
附录:
Referring to the Craigslist Bulk Posting Interfacehelp page, there is an example Perl script included at the end of the page, along with examples of the XML/RSS formats required for bulk-posting.
参考Craigslist 批量发布界面帮助页面,页面末尾包含一个示例 Perl 脚本,以及批量发布所需的 XML/RSS 格式示例。
The simplest way to achieve what you want would be to have a PHP script create the RSS/XML File(s) and then trigger the Perl Script to perform the Upload and record the results into a second file (or straight back to the script).
实现您想要的最简单的方法是让 PHP 脚本创建 RSS/XML 文件,然后触发 Perl 脚本执行上传并将结果记录到第二个文件中(或直接返回脚本) .
回答by krauses
I found an example of a PHP script for CL bulk postings. Not sure if you're still looking for a PHP wrapper for this or not.
我找到了一个用于 CL 批量发布的 PHP 脚本示例。不确定您是否仍在为此寻找 PHP 包装器。
Here's the code I found from this open-reality.org thread: Source: http://support.open-realty.org/showthread.php?23764-Bulk-posting-in-Craigslist
这是我从 open-reality.org 线程中找到的代码:来源:http: //support.open-realty.org/showthread.php?23764-Bulk-posting-in-Craigslist
<?php
class cURL {
var $headers;
var $user_agent;
function cURL()
{
$this->headers[] = 'Connection: Keep-Alive';
$this->headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$this->user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
}
function post($url,$data) {
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
$return = curl_exec($process);
$info = curl_getinfo($process);
curl_close($process);
return $info;
}
}
$postdata = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns:cl=\"http://www.craigslist.org/about/cl-bulk-ns/1.0\">
<channel>
<items>
<rdf:li rdf:resource=\"NYCBrokerHousingSample1\"/>
<rdf:li rdf:resource=\"NYCBrokerHousingSample2\"/>
</items>
<cl:auth username=\"****\"
password=\"****\"
</channel>
<item rdf:about=\"NYCBrokerHousingSample1\">
<cl:category>apa</cl:category>
<cl:area>chi</cl:area>
<cl:subarea>chc</cl:subarea>
<cl:neighborhood>Lakeview</cl:neighborhood>
<cl:housingInfo price=\"1450\"
bedrooms=\"0\"
sqft=\"600\"/>
<cl:replyEmail privacy=\"C\">[email protected]</cl:replyEmail>
<cl:brokerInfo companyName=\"Joe Sample and Associates\"
feeDisclosure=\"fee disclosure here\" />
<title>Spacious Sunny Studio in Upper West Side</title>
<description><![CDATA[
posting body here
]]></description>
</item>
</rdf:RDF>
";
$cc = new cURL();
$url = 'https://post.craigslist.org/bulk-rss/post';
$output = $cc->post($url,$postdata);
//echo $output;
print_r($output);
回答by agwntr
Keep in mind, the API is closed for new accounts as of now. I'm not sure when they are planning on opening it again, if ever.
请记住,截至目前,该 API 已对新帐户关闭。我不确定他们什么时候打算再次打开它,如果有的话。
However, there is a site that does exactly this, and they claim it is legal. www.repost123.com So I am not sure what Craigslist means when they say that any kind of automated posting is illegal.
然而,有一个网站正是这样做的,他们声称这是合法的。www.repost123.com 所以我不确定 Craigslist 说任何类型的自动发布都是非法的。