是否可以通过我自己的网站向 Craigslist 发帖?

发布于 2024-11-10 00:47:10 字数 1191 浏览 2 评论 0原文

我想做的是允许用户使用 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);

?> 

What I am trying to do is allow users to making postings to Craiglist through my own website using PHP curl. This is NOT an automated posting system, I just want users to be able to post onto Craigslist and my website at the same time. So far, I've managed to log in using php but I'm still not sure how to post the title, description, contact information, etc. I am not familiar with cURL.

I'm working with a script I found through 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);

?> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云仙小弟 2024-11-17 00:47:10

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

  1. 邮寄代理

“邮寄代理”是第三方
代理、服务或中介
提议将内容发布到服务
代表他人。适度
对 craigslist 资源的需求,您
不得使用邮寄代理来邮寄
服务内容无明示
许可或许可
克雷格列表。相应地,发帖
代理商不得发帖
代表他人的内容,以引起
如此发布的内容,或以其他方式
访问服务以方便
代表他人发布内容,
除非得到明确许可或
来自 craigslist 的许可。

I don't know if this is possible (it probably is), but it is against Craigslist TOS, so be careful.

  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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文