gpt4 book ai didi

php - 是否可以通过我自己的网站向 Craigslist 发布信息?

转载 作者:可可西里 更新时间:2023-11-01 00:51:30 26 4
gpt4 key购买 nike

我想做的是允许用户使用 PHP curl 通过我自己的网站向 Craiglist 发帖。这不是一个自动发布系统,我只是希望用户能够同时发布到 Craigslist 和我的网站上。到目前为止,我已经成功地使用 php 登录,但我仍然不确定如何发布标题、描述、联系信息等。我不熟悉 cURL。

我正在使用通过 Google 找到的脚本:

<?php

// INIT CURL
$ch = curl_init();

// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'https://accounts.craigslist.org/');

// ENABLE HTTP POST
$email = "email";
$pass = "pass";
$url = "inputEmailHandle=".urlencode($email)."&inputPassword=".urlencode($pass);

curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $url);

$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
curl_setopt($ch, CURLOPT_USERAGENT, $agent);

ob_start();
curl_exec ($ch);
ob_end_clean(); // execute the curl command

curl_close ($ch);
unset($ch);

//initialize second curl
$ch = curl_init();
//second curl
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_URL, 'http://sandiego.craigslist.org/sub/');
$content = curl_exec ($ch);


echo $content;
// CLOSE CURL
curl_close ($ch);

?>

最佳答案

我不知道这是否可能(可能是),但它违反了 Craigslist TOS,所以要小心。

  1. POSTING AGENTS

A "Posting Agent" is a third-party agent, service, or intermediary that offers to post Content to the Service on behalf of others. To moderate demands on craigslist's resources, you may not use a Posting Agent to post Content to the Service without express permission or license from craigslist. Correspondingly, Posting Agents are not permitted to post Content on behalf of others, to cause Content to be so posted, or otherwise access the Service to facilitate posting Content on behalf of others, except with express permission or license from craigslist.

关于php - 是否可以通过我自己的网站向 Craigslist 发布信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6165957/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com