【问题标题】:craigslist bulk posing through HTML Form giving failed to parse RSS errorcraigslist 批量通过 HTML 表单提交无法解析 RSS 错误
【发布时间】:2013-06-14 11:14:24
【问题描述】:

我正在尝试在 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] =>  ).

【问题讨论】:

    标签: php api curl forms http-post


    【解决方案1】:

    第一行应该是 XML 声明。

     <?xml version="1.0"?>
    

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

    【讨论】:

    • 代码在您更改后没问题,但它需要 craigslist 向高级用户提供的 accountID...他们关闭了此服务....:(
    猜你喜欢
    • 2015-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    相关资源
    最近更新 更多