开发者

Craigslist Automated Posting API? [closed]

开发者 https://www.devze.com 2023-01-14 02:13 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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

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


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:

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.


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.

I have also found that others, searching for the same, have resorted to posting jobs on freelancing boards like Freelancer.com to engage developers to create one for them.

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 Interface help 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.

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).


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); 


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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消