#1 Le 16/01/2017, à 10:41
- chris_wafer
Poster une annonce automatiquement
Bonjour,
J'aimerais faire un script en utilisant par-exemple curl qui me permette de me connecter au site LeBonCoin et de déposer une annonce pour le moment sans photo.
Y aurait un expert qui pourrait m'aider?
Merci.
Dernière modification par chris_wafer (Le 16/01/2017, à 10:41)
Hors ligne
#2 Le 16/01/2017, à 10:51
- chris_wafer
Re : Poster une annonce automatiquement
Même en utilisant le soutils du développeur sous FIREFOX, je ne vois pas trop ce que je dois faire. Merci.
Hors ligne
#3 Le 16/01/2017, à 11:36
- k3c
Re : Poster une annonce automatiquement
En Python, tu peux regarder mechanize
la doc
http://wwwsearch.sourceforge.net/mechan … ation.html
quelques exemples
Debian 12 sur Thinkpad reconditionné
Hors ligne
#4 Le 16/01/2017, à 12:41
- chris_wafer
Re : Poster une annonce automatiquement
Mais ça marche pour gérer les cookies?
Car curl a l'air très bien.
Hors ligne
#5 Le 16/01/2017, à 16:15
- k3c
Re : Poster une annonce automatiquement
oui, un exemple
Debian 12 sur Thinkpad reconditionné
Hors ligne
#6 Le 16/01/2017, à 17:06
- chris_wafer
Re : Poster une annonce automatiquement
Tu pourrais faire un exemple avec leBonCoin car je ne vois pas comment je vais faire. Merci.
Hors ligne
#7 Le 16/01/2017, à 22:11
- chris_wafer
Re : Poster une annonce automatiquement
Lorsque j’utilise l’outil de développement du FIREFOX, j'ai ça :
curl 'https://www.leboncoin.fr/' -H 'Host: www.leboncoin.fr' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Cookie: cookieFrame=2; utag_main=v_id:015467a2116c0017f49188a9066d0104c001900900bd0$_sn:86$_ss:1$_st:1484602398969$_pn:1%3Bexp-session$ses_id:1484600598969%3Bexp-session; xtvrn=$562498$266818$; xtan562498=-undefined; xtant562498=1; watch_status=sc:0; ABTasty=LPT148158%3A-2.1477157618%5E%7C%5EABTastyUTMB%3A1%5E%7C%5ELiwioTracking%3A16102219333869813%5E%7C%5EsegmentationTracking%3A16102219333869813%5E%7C%5ELiwioUTMA%3A0.15.1477157618431.1480809976175.1481836207002.4; hideCookieFrame=1; cookieFrame=2; uid=W9Bf7Mteppo2YOIXL5qpWdxGokvfyIf4UO4d3%2FoAdhU%3D; _pulse2data=1702d074-e9ce-457a-964b-deaa6058d9ef,v,x,1482394342225,eyJpc3N1ZWRBdCI6IjIwMTYtMTItMjJUMDc6MTlaIiwiZW5jIjoiQTEyOENCQy1IUzI1NiIsImFsZyI6ImRpciIsImtpZCI6IjIifQ..dfK3WyE0l0r_ifKM2E2KMw.bAiadUZnKVSr07-Fs9YzdFs-dN3EZZvA5oOnbTbF7Y3n-VAh8uNx7E56wC69NZJOvcnpQzM_M3-7y5xRPL0NgCmhmkt_ieuxJWCtmC-4ugLF56g2yKzAEu81PQ6cnH6k1_pGkobY4eZlQjAD99kaYM7X_-DwM49ShQILpESCw7PgQj2X2iKoqDv2Ue6vls1h0TYGRPXo_ISLBQtM4rljuhgU_HybpQ7Aviz2gJ0-UTQ.b8fMzvxJaj9qR4Dutjfr7A,2859052476288557099,1482407842225,true,,eyJraWQiOiIyIiwiYWxnIjoiSFMyNTYifQ..Bg6qSZSZK8GH84U9GmVSDVhtV8_4hs0HeQjySgyLckI; atidvisitor=%7B%22name%22%3A%22atidvisitor%22%2C%22val%22%3A%7B%22vrn%22%3A%22-578706-%22%7D%2C%22options%22%3A%7B%22path%22%3A%22%2F%22%2C%22session%22%3A15724800%2C%22end%22%3A15724800%7D%7D; layout=0; oas_ab=a; ADventoriAlreadyTargeted_Ooshop=1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Cache-Control: max-age=0'
Qu'est ce que je dois garder?
Hors ligne
#8 Le 16/01/2017, à 22:42
- chris_wafer
Re : Poster une annonce automatiquement
J'ai essayé ça mais ça ne marche pas :
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $bot = WWW::Mechanize->new(
agent => 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.6) Gecko/2009020619 Gentoo Iceweasel/3.0.6 '
);
my $response = $bot->get('https://compteperso.leboncoin.fr');
$bot->form_name('loginform');
$bot->field( st_username => 'XXXXX' );
$bot->field( st_passwd => 'XXXXX' );
$bot->submit();
Une idée?
Hors ligne
#9 Le 16/01/2017, à 23:05
- chris_wafer
Re : Poster une annonce automatiquement
J'ai fait ça aussi en bash, mais ça marche pas :
curl 'https://compteperso.leboncoin.fr/' -H 'Host: compteperso.leboncoin.fr' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1'
curl 'https://compteperso.leboncoin.fr/store/verify_login/0' -H 'Host: compteperso.leboncoin.fr' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://compteperso.leboncoin.fr/account/index.html' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' --data 'st_username=xxxxxxxxxx&st_passwd=xxxxxxxxxx'
De l'aide???
Hors ligne
#10 Le 17/01/2017, à 10:59
- chris_wafer
Re : Poster une annonce automatiquement
Personne peut vraiment m'aider?
Un expert curl?
Hors ligne
#11 Le 17/01/2017, à 20:35
- k3c
Re : Poster une annonce automatiquement
si tu veux poster une annonce, il faut d'abord te connecter
le lien pour déposer une annonce comporte plein de champs, si je regarde avec mech-dump
$ mech-dump https://www2.leboncoin.fr/ai/form/0?ca=12_s
Wide character in print at /usr/share/perl5/WWW/Mechanize.pm line 2223.
POST https://www2.leboncoin.fr/ai/verify/0 (multipart/form-data) [formular]
s=red1x35dee23072e0e20dc588955a73a214f555c24920 (hidden readonly)
check_type_diff=1 (hidden readonly)
category=0 (option) [*0/«Choisissez une catégorie»|-71/-- EMPLOI --|33/Offres d'emploi|-1/-- VEHICULES --|2/Voitures|3/Motos|4/Caravaning|5/Utilitaires|6/Equipement Auto|44/Equipement Moto|50/Equipement Caravaning|7/Nautisme|51/Equipement Nautisme|-8/-- IMMOBILIER --|9/Ventes immobilières|10/Locations|11/Colocations|13/Bureaux & Commerces|-66/-- VACANCES --|12/Locations & Gîtes|67/Chambres d'hôtes|68/Campings|69/Hôtels|70/Hébergements insolites|-14/-- MULTIMEDIA --|15/Informatique|43/Consoles & Jeux vidéo|16/Image & Son|17/Téléphonie|-18/-- MAISON --|19/Ameublement|20/Electroménager|45/Arts de la table|39/Décoration|46/Linge de maison|21/Bricolage|52/Jardinage|22/Vêtements|53/Chaussures|47/Accessoires & Bagagerie|42/Montres & Bijoux|23/Equipement bébé|54/Vêtements bébé|-24/-- LOISIRS --|25/DVD / Films|26/CD / Musique|27/Livres|28/Animaux|55/Vélos|29/Sports & Hobbies|30/Instruments de musique|40/Collection|41/Jeux & Jouets|48/Vins & Gastronomie|-56/-- MATERIEL PROFESSIONNEL --|57/Matériel Agricole|58/Transport - Manutention|59/BTP - Chantier Gros-oeuvre|60/Outillage - Matériaux 2nd-oeuvre|32/Équipements Industriels|61/Restauration - Hôtellerie|62/Fournitures de Bureau|63/Commerces & Marchés|64/Matériel Médical|-31/-- SERVICES --|34/Prestations de services|35/Billetterie|49/Evénements|36/Cours particuliers|65/Covoiturage|-37/-- -- --|38/Autres]
company_ad=0 (radio) [*0/Particulier|1/Professionnel]
type=s (radio) [*s/Offres|k/Demandes]
subject= (text)
brand= (option) [*/«Choisissez»|Audi|Bmw|Citroen|Fiat|Ford|Mercedes|Opel|Peugeot|Renault|Volkswagen|Abarth|Aleko|Alfa Romeo|Alpina|Aro|Artega|Aston Martin|Autobianchi|Auverland|Bentley|Bertone|Bluecar Groupe Bollore|Buick|Cadillac|Chevrolet|Chrysler|Corvette|Dacia|Daewoo|Daihatsu|Dangel|De La Chapelle|Dodge|Donkervoort|Ds|Ferrari|Fisker|Gme|Honda|Hummer|Hyundai|Infiniti|Isuzu|Iveco|Jaguar|Jeep|Kia|Lada|Lamborghini|Lancia|Land Rover|Lexus|Lotus|Mahindra|Maruti|Maserati|Mastretta|Maybach|Mazda|Mclaren|Mega|Mg|Mia|Mini|Mitsubishi|Morgan|Nissan|Pgo|Piaggio|Polski/fso|Pontiac|Porsche|Proton|Rolls-royce|Rover|Saab|Santana|Seat|Shuanghuan|Skoda|Smart|Ssangyong|Subaru|Suzuki|Talbot|Tavria|Tesla|Toyota|Tvr|Venturi|Volvo|Autres]
model= (option disabled) [*/«Choisissez»]
regdate= (option) [*/«Choisissez»]
<NONAME>= (hidden readonly)
mileage= (tel)
fuel= (option) [*/«Choisissez»|1/Essence|2/Diesel|3/GPL|4/Electrique|5/Autre]
gearbox= (option) [*/«Choisissez»|1/Manuelle|2/Automatique]
cubic_capacity= (tel)
real_estate_type= (option) [*/«Choisissez»|1/Maison|2/Appartement|3/Terrain|4/Parking|5/Autre]
furnished= (option) [*/«Choisissez»|1/Meublé|2/Non meublé]
square= (tel)
rooms= (tel)
energy_rate= (option) [*/«Choisissez»|a/A (moins de 50)|b/B (de 51 à 90)|c/C (de 91 à 150)|d/D (de 151 à 230)|e/E (de 231 à 330)|f/F (de 331 à 450)|g/G (de 451 à 590)|h/H (de 591 à 750)|i/I (751 et plus)|v/Vierge]
ges= (option) [*/«Choisissez»|a/A (moins de 5)|b/B (de 6 à 10)|c/C (de 11 à 20)|d/D (de 21 à 35)|e/E (de 36 à 55)|f/F (de 56 à 80)|g/G (de 81 à 110)|h/H (de 111 à 145)|i/I (146 et plus)|v/Vierge]
capacity= (text)
swimming_pool= (option) [*/«Choisissez»|1/Oui|2/Non]
bedrooms= (text)
clothing_type= (option) [*/«Choisissez»|1/Femme|2/Femme enceinte|3/Homme|4/Enfant]
clothing_st=0 (option) [*0/«Choisissez»|1|2|3|4|5|6|7|8|9|10]
shoe_type= (option) [*/«Choisissez»|1/Femme|2/Homme|3/Enfant]
shoe_size= (option) [*/«Choisissez»|1/16|2/17|3/18|4/19|5/20|6/21|7/22|8/23|9/24|10/25|11/26|12/27|13/28|14/29|15/30|16/31|17/32|18/33|19/34|20/35|21/36|22/37|23/38|24/39|25/40|26/41|27/42|28/43|29/44|30/45|31/46|32/47|33/48|34/49|35/50 et plus]
baby_age= (option) [*/«Choisissez»|p/Prématuré|0/0 mois|1/1 mois|3/3 mois|6/6 mois|9/9 mois|12/12 mois|18/18 mois|24/24 mois|36/36 mois]
jobcontract= (option) [*/«Choisissez»|1/CDD|2/CDI|3/Intérim|4/Indépendant/Franchise|6/Apprentissage|5/Stage/Alternance]
jobfield=0 (option) [*0/«Choisissez»|1/Agriculture|4/Banque/Assurance/Finance|2/BTP/Construction|3/Commerce/Distribution|13/Hôtellerie/Restauration|6/Immobilier|5/Industrie/Environnement|8/Médecine/Santé|9/Services|7/Services publics/Administrations|15/Sport|10/Télécom/Internet/Médias|14/Textile/Mode/Luxe|11/Tourisme|12/Transport/Logistique]
jobduty=0 (option) [*0/«Choisissez»|1/Administration/Services généraux|2/Commercial/Vente|3/Comptabilité/Gestion/Finance|4/Conseil/Audit|5/Direction Générale|16/Etudes/Recherches/Ingénieries|15/Formation/Education|7/Hôtellerie/Restauration|8/Informatique/Internet|9/Juridique|10/Logistique/Achat/Transport|11/Marketing/Communication|18/Médecine/Santé|12/Ménage/Entretien|17/Ouvrier/Artisan|19/Production/Opérations|13/Ressources Humaines/Formation|6/Sécurité/Défense/Gardiennage|14/Services à la personne|20/Service Client/Accueil]
jobexp=0 (option) [*0/«Choisissez»|1/0 à 2 ans|3/2 à 5 ans|5/5 ans et plus]
jobstudy=0 (option) [*0/«Choisissez»|1/Sans diplôme|2/BEP/CAP|3/Employé/Ouvrier spécialisé/Bac|4/Technicien/Employé/Bac+2|5/Agent de maîtrise/Bac+3|6/Ingénieur/Cadre/Bac+5 ou plus]
jobtime=1 (radio) [*1/Temps plein|2/Temps partiel]
animal_type= (option) [*/«Choisissez»|1/Chiens & Chats|2/Autres animaux|3/Accessoires]
vaccinated_animal=<UNDEF> (radio) [1/Oui|2/Non]
animal_offer_nature= (option) [*/«Choisissez»|1/Vente|2/Don|3/Saillie]
animal_race= (option) [*/«Choisissez»|1/LOF / LOOF|2/D apparence/type/non LOF/non LOOF]
animal_age= (option) [*/«Choisissez»|1/Plus de 8 semaines (sevré)|2/Moins de 8 semaines (à réserver)|3/Adulte]
animal_litter= (text)
animal_litter_number= (text)
animal_identification_type=<UNDEF> (radio) [tattooed_animal/Tatoué|animal_chips/Pucé]
animal_identification= (text)
animal_first_litter=<UNDEF> (checkbox) [*<UNDEF>/off|1]
cmd_ldv=<UNDEF> (checkbox) [*<UNDEF>/off|on/€ 6 mois Offre exceptionnelle ! Seulement 1€ (TTC) pour 6 mois ! (Soit l'équivalent de € / mois)]
datepicker_begin_date= (text readonly)
availability_begin_date= (hidden readonly)
datepicker_end_date= (text readonly)
availability_end_date= (hidden readonly)
availability_price= (tel)
<NONAME>=<UNDEF> (submit)
price_min= (tel)
price_max= (tel)
body= (textarea)
custom_ref= (text)
price= (tel)
charges_included= (option) [*/«Choisissez»|1/Oui|2/Non]
fai_included= (option) [*/«Choisissez»|1/Oui|2/Non]
cmd_photosup=<UNDEF> (checkbox) [*<UNDEF>/off|on/Pack de 7 photos supplémentaires En savoir plus]
location_p= (text)
zipcode= (hidden readonly)
city= (hidden readonly)
region=12 (hidden readonly)
dpt_code= (hidden readonly)
address= (text)
<NONAME>=<UNDEF> (button disabled)
meeting_point_id= (option) [*/Sélectionnez votre point de rencontre]
accept_localisation=<UNDEF> (checkbox) [*<UNDEF>/off|on]
latitude= (hidden readonly)
longitude= (hidden readonly)
geo_source= (hidden readonly)
geo_provider= (hidden readonly)
adreply_type=1 (radio) [*1/Votre email|2/Votre site web]
adreply_redirect= (text)
name= (text)
siren= (hidden readonly)
email= (email)
phone= (tel)
phone_hidden=<UNDEF> (checkbox) [*<UNDEF>/off|1/Masquer le numéro de téléphone dans l'annonce.]
no_salesmen=1 (checkbox) [<UNDEF>/off|*1/Je ne souhaite pas être sollicité par des sociétés étrangères au site leboncoin.fr]
<NONAME>=Valider (submit)
$
Pour commencer il faut te connecter, donc donner ton identifiant et ton mot de passe.
Debian 12 sur Thinkpad reconditionné
Hors ligne
#12 Le 17/01/2017, à 23:08
- chris_wafer
Re : Poster une annonce automatiquement
Merci pour ces informations.
Mais justement quel est la commande pour se connecter? Merci.
Hors ligne
#13 Le 18/01/2017, à 09:56
- k3c
Re : Poster une annonce automatiquement
Debian 12 sur Thinkpad reconditionné
Hors ligne
#14 Le 18/01/2017, à 20:43
- chris_wafer
Re : Poster une annonce automatiquement
Coucou,
Je vais peut-pêtre abusé mais tu pourrais me donner un exmple où j'aurais juste à remplacer mon login et mon mot de passe?
Car j'avoue que je suis complètement perdu.
Merci.
Hors ligne
#15 Le 29/01/2017, à 18:29
- chris_wafer
Re : Poster une annonce automatiquement
Un petit UP pour avoir une grosse aide... je n'avance pas... Merci.
Hors ligne
#16 Le 28/02/2017, à 23:10
- chris_wafer
Re : Poster une annonce automatiquement
Je progresse, je progresse, je suis arrivé à me logguer!!!
Mais quand je veux poster une nouvelle annonce avec MECHANISE, il me répond : "301 Moved Permanently".
Quelqu'un peut me dire où il y a on erreur, car je patoge là... Merci.
Voici mon code :
#!/usr/bin/perl
use strict; use warnings;
use WWW::Mechanize;
use HTML::Tree;
use Time::HiRes qw(gettimeofday);
use IO::Handle;
#-----------------------------------------------------
my $lLogin = 'MonMail';
my $lPass = 'MonPass';
my $lAlias = 'MonAlias';
my $lPhone = 'MonPhone';
#-----------------------------------------------------
my $url = "";
my $return = "";
my $fichier = "";
my $bot = WWW::Mechanize->new(
agent => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0",
timeout => 3,
autocheck => 1, # check success of each query
stack_depth => 0, # no keeping history
keep_alive => 50, # connection pool
);
$bot->stack_depth(0);
open my $debugfile, '>traffic.txt';
$debugfile->autoflush(1);
$bot->add_handler( request_send => sub {
my $cur_time = gettimeofday();
my $req = shift;
print $debugfile "\n$cur_time === BEGIN HTTP REQUEST ===\n";
print $debugfile $req->dump();
print $debugfile "\n$cur_time === END HTTP REQUEST ===\n";
return
}
);
$bot->add_handler( response_header => sub {
my $cur_time = gettimeofday();
my $res = shift;
print $debugfile "\n$cur_time === GOT RESPONSE HDRS ===\n";
print $debugfile $res->dump();
return
}
);
$bot->add_handler( response_data => sub {
my $cur_time = gettimeofday();
my $res = shift;
my $content_length = length($res->content);
print $debugfile "$cur_time === Got response data chunk resp size = $content_length ===\n";
return
}
);
$bot->add_handler( response_done => sub {
my $cur_time = gettimeofday();
my $res = shift;
print $debugfile "\n$cur_time === BEGIN HTTP RESPONSE ===\n";
print $debugfile $res->dump();
print $debugfile "\n=== END HTTP RESPONSE ===\n";
return
}
);
unlink 'cookies.txt';
$bot->cookie_jar(
HTTP::Cookies->new(
file => "cookies.txt",
autosave => 1,
ignore_discard => 1,
)
);
sub AjouterAnnonces()
{
$url = "https://compteperso.leboncoin.fr/store/verify_login";
$bot->get($url);
$return=$bot->form_name('loginform');
$return=$bot->field( st_username => $lLogin );
$return=$bot->field( st_passwd => $lPass );
$return=$bot->submit();
$url = "https://compteperso.leboncoin.fr/store/verify_login";
$bot->get($url);
$url = "https://www.leboncoin.fr/ai?ca=12_s";
$return=$bot->get($url);
# ===================================================================
# > Débeugage
# ===================================================================
$fichier="MaSortie01.html";
print "01\n";
print "REPONSE (is_success) : ", $bot->response->is_success, "\n";
print "REPONSE (status_line) : ", $bot->response->status_line, "\n";
print "REPONSE (error_as_HTML) : ", $bot->response->error_as_HTML, "\n";
open(MON_FICHIER, ">$fichier") || die "Erreur E/S:$!\n";
print MON_FICHIER $bot->content;
close(MON_FICHIER);
# ===================================================================
my $id_annonce=$return->base;
$id_annonce =~ s/\?.*$//;
$id_annonce =~ s/^.*\///;
$url="https://www.leboncoin.fr/ai/verify/$id_annonce";
$return = $bot->post(
$url,
[ 'check_type_diff' => '0',
'category' => '35',
'company_ad' => '0',
'type' => '5',
'subject' => 'Places concert Muse',
'brand' => '',
'regdate' => '',
'mileage' => '',
'fuel' => '',
'gearbox' => '',
'cubic_capacity' => '',
'real_estate_type' => '',
'furnished' => '',
'square' => '',
'rooms' => '',
'energy_rate' => '',
'ges' => '',
'capacity' => '',
'swimming_pool' => '',
'bedrooms' => '',
'clothing_type' => '',
'clothing_st' => '',
'shoe_type' => '',
'shoe_size' => '',
'baby_age' => '',
'jobcontract' => '',
'jobfield' => '0',
'jobduty' => '0',
'jobexp' => '0',
'jobstudy' => '0',
'jobtime' => '1',
'animal_offer_nature' => '',
'animal_race' => '',
'animal_age' => '',
'animal_litter' => '',
'animal_litter_number' => '',
'animal_identification' => '',
'datepicker_begin_date' => '',
'availability_begin_date' => '',
'datepicker_end_date' => '',
'availability_end_date' => '',
'availability_price' => '',
'price_min' => '',
'price_max' => '',
'body' => 'Vend places concert Muse. A Bordeaux.',
'custom_ref' => '',
'price' => '90',
'charges_included' => '',
'fai_included' => '',
'image0' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image1' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image2' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image3' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image4' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image5' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image6' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image7' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image7' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image8' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'image9' => [
undef, # yes, undef!
'', #filename
'Content_Type' => 'application/octet-stream',
'Content' => ''
],
'location_p' => 'Bordeaux 33000',
'zipcode' => '33000',
'city' => 'Bordeaux',
'region' => '2',
'dpt_code' => '',
'location_p' => '33',
'address' => '',
'meeting_point_id' => '',
'accept_localisation' => 'on',
'latitude' => '44.83885',
'longitude' => '-0.58115',
'geo_source' => 'city',
'geo_provider' => 'lbc',
'adreply_type' => '1',
'adreply_redirect' => '',
'name' => "$lAlias",
'email' => "$lLogin",
'phone' => "$lPhone",
'phone_hidden' => '1',
'no_salesmen' => '1'
],
'Content_Type' => 'form-data'
);
# ===================================================================
# > Débeugage
# ===================================================================
$fichier="MaSortie02.html";
print "02\n";
print "REPONSE (is_success) : ", $bot->response->is_success, "\n";
print "REPONSE (status_line) : ", $bot->response->status_line, "\n";
print "REPONSE (error_as_HTML) : ", $bot->response->error_as_HTML, "\n";
open(MON_FICHIER, ">$fichier") || die "Erreur E/S:$!\n";
print MON_FICHIER $bot->content;
close(MON_FICHIER);
# ===================================================================
$url="https://www2.leboncoin.fr/ai/preview/$id_annonce";
$return = $bot->get($url);
# ===================================================================
# > Débeugage
# ===================================================================
$fichier="MaSortie03.html";
print "03\n";
print "REPONSE (is_success) : ", $bot->response->is_success, "\n";
print "REPONSE (status_line) : ", $bot->response->status_line, "\n";
print "REPONSE (error_as_HTML) : ", $bot->response->error_as_HTML, "\n";
open(MON_FICHIER, ">$fichier") || die "Erreur E/S:$!\n";
print MON_FICHIER $bot->content;
close(MON_FICHIER);
# ===================================================================
$url="https://www2.leboncoin.fr/ai/create/$id_annonce";
$return = $bot->post(
$url,
[ 'category' => '33',
'city' => 'Bordeaux',
'accept_rule' => '1',
'create' => 'Valider mon annonce',
'create2' => 'Valider',
'category' => '35',
'category' => '35',
'category' => '35'
],
'Content_Type' => 'form-data'
);
# ===================================================================
# > Débeugage
# ===================================================================
$fichier="MaSortie04.html";
print "04\n";
print "REPONSE (is_success) : ", $bot->response->is_success, "\n";
print "REPONSE (status_line) : ", $bot->response->status_line, "\n";
print "REPONSE (error_as_HTML) : ", $bot->response->error_as_HTML, "\n";
open(MON_FICHIER, ">$fichier") || die "Erreur E/S:$!\n";
print MON_FICHIER $bot->content;
close(MON_FICHIER);
# ===================================================================
$url="https://www2.leboncoin.fr/ai/confirm_no_pay/$id_annonce";
$return = $bot->get($url);
# ===================================================================
# > Débeugage
# ===================================================================
$fichier="MaSortie05.html";
print "05\n";
print "REPONSE (is_success) : ", $bot->response->is_success, "\n";
print "REPONSE (status_line) : ", $bot->response->status_line, "\n";
print "REPONSE (error_as_HTML) : ", $bot->response->error_as_HTML, "\n";
open(MON_FICHIER, ">$fichier") || die "Erreur E/S:$!\n";
print MON_FICHIER $bot->content;
close(MON_FICHIER);
# ===================================================================
}
AjouterAnnonces();
Hors ligne