26

我正在浏览 craigslist 批量发布部分,它需要将 rss 提要发送到服务器以自动发布添加该网站的地址

http://www.craigslist.org/about/bulk_posting_interface

我已经上下查找了一个 php 类的示例,但找不到。任何人都知道存在的任何课程吗?谢谢

4

4 回答 4

12

我刚刚检查了 CL 的使用条款,它明确提到任何自动发布都是非法的。因此,如果您希望扩大通用商业理念,请注意:

明确禁止使用任何自动方式将内容发布到 craigslist。用户必须通过发布过程的所有步骤亲自和手动发布所有内容。还明确禁止任何用户开发、提供、营销、销售、分发或提供自动化手段来执行发布过程的任何步骤(全部或部分)。任何开发、提供、营销、销售、分发或提供自动化方式来执行发布过程的任何步骤(全部或部分)的用户应对 CL 对每次访问 craigslist 的实例(由任何用户或其他第三方)使用该自动化方式。

于 2012-07-15T16:02:33.043 回答
8

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.

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

<?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\">bulkuser@bulkposterz.net</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); 
于 2011-06-28T04:09:35.597 回答
8

我已经为您搜索了这个,并找到了相同的结果 - 目前,似乎没有任何现有的、可免费获得的 PHP 类来处理 Craigslist 批量上传。

我还发现其他人也在寻找同样的东西,他们求助于在Freelancer.com等自由职业者板上发布工作,以吸引开发人员为他们创建一个。

看起来你必须自己编写这段代码,或者花钱请人为你做。对不起。

附录:

参考Craigslist Bulk Posting Interface帮助页面,页面末尾包含一个示例 Perl 脚本,以及批量发布所需的 XML/RSS 格式示例。

实现您想要的最简单的方法是让 PHP 脚本创建 RSS/XML 文件,然后触发 Perl 脚本执行上传并将结果记录到第二个文件中(或直接返回到脚本) .

于 2010-09-03T11:32:51.673 回答
0

请记住,该 API 目前已对新帐户关闭。我不确定他们何时计划再次打开它,如果有的话。

但是,有一个网站正是这样做的,他们声称这是合法的。www.repost123.com 所以我不确定 Craigslist 说任何类型的自动发布都是非法的是什么意思。

于 2011-08-18T21:50:08.863 回答