2

我正在尝试在 Craigslist 上发布他们的批量 rss 数据构成方法。

为此,我使用以下代码:

<form method="POST" action="https://post.craigslist.org/bulk-rss/post" enctype="text/xml">
    <input name="add" type="submit" value="Create"  />
    <input type="hidden" name="data" value='<?php echo '<?xml version="1.0"?>
    <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="user@demo.com"
                 password="demo123"
                 accountID="0"/>
      </channel>

      <item rdf:about="NYCBrokerHousingSample1">
        <cl:category>fee</cl:category>
        <cl:area>nyc</cl:area>
        <cl:subarea>mnh</cl:subarea>
        <cl:neighborhood>Upper West Side</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>

      <item rdf:about="NYCBrokerHousingSample2">
        <cl:category>fee</cl:category>
        <cl:area>nyc</cl:area>
        <cl:subarea>mnh</cl:subarea>
        <cl:neighborhood>Chelsea</cl:neighborhood>
        <cl:housingInfo price="2175"
                        bedrooms="1"
                        sqft="850"
                        catsOK="1"/>
        <cl:mapLocation city="New York"
                        state="NY"
                        crossStreet1="23rd Street"
                        crossStreet2="9th Avenue"/>
        <cl:replyEmail privacy="C" 
                       otherContactInfo="212.555.1212">
          bulkuser@bulkposterz.net
        </cl:replyEmail>
        <cl:brokerInfo companyName="Joe Sample and Associates"
                       feeDisclosure="fee disclosure here" />
        <title>1BR Charmer in Chelsea</title>
        <description><![CDATA[
          posting body goes here
        ]]></description>
        <cl:PONumber>Purchase Order 094122</cl:PONumber>
      </item>
    </rdf:RDF>' ?>'>
    </form> 

当我按下创建按钮时,它会发布数据以形成操作 url

并给出以下错误:

无法解析 RSS:第 1 行第 3 列第 3 字节的格式不正确(无效令牌)

我想知道我是否以正确的方式进行操作?

如果是,请帮助我解决错误,

如果不建议我换个方式

这是创建帐户的链接:https ://accounts.craigslist.org/

我还想提一提我也尝试过 curl 方式,如这个问题 Craigslist Automated Posting API?的答案所示。见答案(krauses)

它在浏览器中显示以下结果并且不发布任何内容:

Array (
    [url] => https://post.craigslist.org/bulk-rss/post
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 1.781
    [namelookup_time] => 1.438
    [connect_time] => 1.797
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [redirect_url] =>  ).
4

1 回答 1

0

第一行应该是 XML 声明。

 <?xml version="1.0"?>

编辑:根据http://www.craigslist.org/about/bulk_posting_interface#submission_format

于 2013-06-24T18:05:51.873 回答