Page 1 sur 1

Posté automatiquement une annonce sur leboncoin via curl

Posté : 27 juil. 2010, 15:59
par touriste57
Bonjour,

Je suis en train de chercher un faire un script pour poster automatiquement une annonce sur le site du bon coin . fr
J'ai commencé un script mais ca ne marche pas. Je pense qu'il le manque pas grand chose. Pourriez vous m'aider?
D'avance merci,
<?php

$fp = fopen("cookies.txt",'wb');
fclose($fp);

$useragent = "Mozilla/5.0";

$url = "http://www2.leboncoin.fr/ai/preview/1";
$ch = curl_init($url);
//curl_setopt($ch , CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch , CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$referer = $url;
$postfields = array();
$postfields["check_type_diff"] = "0";
$postfields["region"] = "18";
$postfields["dpt_code"] = "49";
$postfields["zipcode"] = "49230";
$postfields["category"] = "2";
$postfields["company_ad"] = "1";
$postfields["type"] = "s";
$postfields["name"] = "aaa";
$postfields["email"] = "[email protected]";
$postfields["phone"] = "0240121652";
$postfields["phone_hidden"] = "1";
$postfields["subject"] = "Vends Renault Laguna Bleu Break";
$postfields["body"] = "Je vends ma Renault Laguna Break couleur noir. Elle a 76000km. ";
$postfields["price"] = "12000";
//$postfields["image"] = "C:\!\funpics\60440.jpg";
//postfields["image"] = "@60440.jpg";
$postfields["image"] = "";
$postfields["siren"] = "732829320";
$postfields["fuel"] = "2";
$postfields["regdate"] = "2007";
$postfields["mileage"] = "76000";
$postfields["gearbox"] = "2";

$postfields["validate"] = "Valider";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
curl_close($ch);



$url = "http://www2.leboncoin.fr/ai/confirm/3";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$referer = $url;
$postfields = array();
$postfields["passwd"] = "wqazsx";
$postfields["passwd_ver"] = "wqazsx";
$postfields["create"] = "Valider";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

?>

Re: Posté automatiquement une annonce sur leboncoin via curl

Posté : 28 juil. 2010, 11:14
par touriste57
Bonjour,
Je vois que vous n'avez pas plus d'idée que moi.
Tant pis. Je continue de chercher et si je trouve la solution je la posterais.

Si vous avez une idée merci de votre aide

Did

Re: Posté automatiquement une annonce sur leboncoin via curl

Posté : 28 juil. 2010, 11:47
par Invité
Bonjour,

pourquoi as tu mis check_type_diff à 0 ?
Dans le formulaire la valeur est 1 en hidden

Re: Posté automatiquement une annonce sur leboncoin via curl

Posté : 08 sept. 2011, 17:01
par eniot666
Bonjour,

Je cherche a faire la meme chose que toi... :D Es-ce que par hazard tu partagerai ton code final ?

Merci par avance.

Eniot

Re: Posté automatiquement une annonce sur leboncoin via curl

Posté : 02 déc. 2011, 00:00
par Web33
J'ai développé une solution à base de VB pour ce faire.
Pour les intéressés => MP :)

Re: Posté automatiquement une annonce sur leboncoin via curl

Posté : 05 déc. 2011, 01:33
par asiaze
Bonjour et je suppose qu'il faut payer bien sûr :)

activer mail le bon coin

Posté : 21 janv. 2012, 16:53
par Gilliocq
Bonjour,

Je suis en train de chercher un faire un script pour poster automatiquement une annonce sur le site du bon coin . fr
J'ai commencé un script mais ca ne marche pas. Je pense qu'il le manque pas grand chose. Pourriez vous m'aider?
D'avance merci,
<?php

$fp = fopen("cookies.txt",'wb');
fclose($fp);

$useragent = "Mozilla/5.0";

$url = "http://www2.leboncoin.fr/ai/preview/1";
$ch = curl_init($url);
//curl_setopt($ch , CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch , CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$referer = $url;
$postfields = array();
$postfields["check_type_diff"] = "0";
$postfields["region"] = "18";
$postfields["dpt_code"] = "49";
$postfields["zipcode"] = "49230";
$postfields["category"] = "2";
$postfields["company_ad"] = "1";
$postfields["type"] = "s";
$postfields["name"] = "aaa";
$postfields["email"] = "[email protected]";
$postfields["phone"] = "0240121652";
$postfields["phone_hidden"] = "1";
$postfields["subject"] = "Vends Renault Laguna Bleu Break";
$postfields["body"] = "Je vends ma Renault Laguna Break couleur noir. Elle a 76000km. ";
$postfields["price"] = "12000";
//$postfields["image"] = "C:\!\funpics\60440.jpg";
//postfields["image"] = "@60440.jpg";
$postfields["image"] = "";
$postfields["siren"] = "732829320";
$postfields["fuel"] = "2";
$postfields["regdate"] = "2007";
$postfields["mileage"] = "76000";
$postfields["gearbox"] = "2";

$postfields["validate"] = "Valider";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
curl_close($ch);



$url = "http://www2.leboncoin.fr/ai/confirm/3";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$referer = $url;
$postfields = array();
$postfields["passwd"] = "wqazsx";
$postfields["passwd_ver"] = "wqazsx";
$postfields["create"] = "Valider";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

?>