[Bénévole] recherche webmaster ou codeur php
Ferméjetrouvetous Messages postés 45 Date d'inscription mercredi 4 mai 2022 Statut Membre Dernière intervention 18 septembre 2022 - 18 sept. 2022 à 20:02
- [Bénévole] recherche webmaster ou codeur php
- Rechercher ou entrer l'adresse - Guide
- Recherche automatique des chaînes ne fonctionne pas - Guide
- Easy php - Télécharger - Divers Web & Internet
- Rechercher ou entrer l'adresse - recherche google - Guide
- Recherche musique - Guide
20 réponses
Modifié le 22 août 2022 à 21:16
Bonsoir,
Le recrutement est interdit (cf La charte du forum).
Si tu souhaites de l’aide , il faudra mettre ton code dans ta prochaine réponse afin qu’un webmaster y jette un œil. Il faudra utiliser les balises de code https://codes-sources.commentcamarche.net/faq/11288-poster-un-extrait-de-code
Bien cordialement.
Modifié le 22 août 2022 à 22:03
Bonsoir désolé je recherche juste un coup de main
Voici le code que j'ai modifier ( une autre passerelle (immo) que j'essaie de rendre compatible (en auto) )
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author ZADS * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_service_auto($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_imo = getRegionByCp($departement); $reg = $location_imo['region']; $county = $location_imo['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": $cat_typ = "vehicule"; $id_cat = 21; $$annee_modele = ($row->bien->$annee_modele); if (!empty($$annee_modele)){ if ($$annee_modele > 1970 ){ $type_de_vente = implode('=',array(29 , "NEUF")); }else{ $type_de_vente = implode('=',array(29 , "OCCASION")); } }else{ $type_de_vente = ''; } break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto – Scooter"; $id_cat = 22; $$annee_modele = ($row->bien->$annee_modeleruction); if (!empty($$annee_modele)){ if ($$annee_modele > 1970 ){ $type_de_vente = implode('=',array(29 , "NEUF")); }else{ $type_de_vente = implode('=',array(29 , "OCCASION")); } }else{ $type_de_vente = ''; } break; case "M": $id_cat = 22; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "VOITURES": $type_bien = implode('=',array(17 , "VOITURES")); break; case "MOTO": $type_bien = implode('=',array(17 , "MOTO")); break; case "SCOOTER": $type_bien = implode('=',array(17 , "SCOOTER")); break; case "QUAD": $type_bien = implode('=',array(17 , "QUAD")); break; case "Utilitaire": $type_bien = implode('=',array(149 , "Utilitaire")); break; } } $annee_modele =''; $marque_voiture =''; $nombre_portes =''; $kilometrages =''; $couleur =''; $carburant =''; $puissance_fiscale =''; $boite_vitesse =''; $cylindree =''; if (!empty($row->bien->annee_modele->annee_modele)){ $classe_annee_modele = implode('=',array(28 , ($row->bien->annee_modele->annee_modele))); } if (!empty($row->bien->couleur->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur->couleur))); } if (!empty($row->bien->marque_voiture)){ $marque_voiture = implode('=',array(29 , ($row->bien->marque_voiture))); } if (!empty($row->bien->nombre_portes)){ $nombre_portes = implode('=',array(133 , ($row->bien->nombre_portes))); } if (!empty($row->bien->chambres)){ $nb_chambres = implode('=',array(14 , ($row->bien->nb_chambres))); } if (!empty($row->bien->kilometrages)){ $kilometrages = implode('=',array(23 , ($row->bien->kilometrages))); } if (!empty($row->bien->carburant)){ $carburant = implode('=',array(9 , ($row->bien->carburant))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , 'puissance_fiscale')); } if (!empty($row->bien->Boite_de_vitesse)){ $boite_vitesse = implode('=',array(31 , 'Boite_de_vitesse')); } if (!empty($row->bien->cylindree)){ $cylindree = implode('=',array(30 , 'cylindree')); } } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($annee_modele ='', $marque_voiture ='', $nombre_portes ='', $kilometrages ='', $couleur ='', $carburant ='', $puissance_fiscale ='', $boite_vitesse ='', $cylindree =''); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " ); $user_id = $result_user['id']; if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'®ion='.$name_reg.'®ioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'®ion='.$name_reg.'®ioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } } else { $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
Je peut donner plus de détails en mp ou par mail
Merci
23 août 2022 à 09:50
Bonjour,
Tu vas dire que je me répète ..mais je suis bien obligé de te reposer les mêmes questions qu'au mois de mai
Qu'as tu fais exactement ?
A quoi ressemble le xml ?
As tu regardé la doc d'ubiflow ?
As tu contacté leur support ?
Et le plus important .. Sur quoi bloques tu précisément ?
23 août 2022 à 12:16
Bonjour,
J'ai modifier toutes les lignes immo pour mettre en auto .
Mon xml du moins une annonce démo d'ubiflow et non mon flux en entier.
Et ubiflow ne veulent pas intervenir car se n'ai pas une passerelle creer par leurs services je doit me débrouiller tous seul.
Cordialement
<client code="ag579249"> <coordonnees> <raison_sociale>TEST UBIFLOW VO</raison_sociale> <adresse> <voirie>La vallée</voirie> <code_postal>35830</code_postal> <ville>BETTON</ville> </adresse> <telephone>02 99 83 05 36</telephone> <fax>02 72 68 61 05</fax> <email>***@***</email> <web>www.ubiflow.net</web> </coordonnees> <annonce id="199201747"> <reference>30685</reference> <titre>Citroën Jumper 35 L3H2 HDI 120 CONFORT</titre> <texte>Barres de toit</texte> <date_integration>31/07/2012 09:48:50</date_integration> <contact_a_afficher>TEST UBIFLOW VO</contact_a_afficher> <email_a_afficher>***@***</email_a_afficher> <telephone_a_afficher>02 99 83 05 36</telephone_a_afficher> <photos> <photo>http://www.ubiflow.net/photos/420066/199201747/photos/1.jpg <photo>http://www.ubiflow.net/photos/420066/199201747/photos/2.jpg <photo>http://www.ubiflow.net/photos/420066/199201747/photos/3.jpg <photo>http://www.ubiflow.net/photos/420066/199201747/photos/4.jpg <photo>http://www.ubiflow.net/photos/420066/199201747/photos/5.jpg <photo>http://www.ubiflow.net/photos/420066/199201747/photos/6.jpg </photos> <vehicule> <code_type>12100</code_type> <premiere_main>0</premiere_main> <mise_en_circulation>23/07/2012</mise_en_circulation> <millesime>2012</millesime> <kilometrage>42300</kilometrage> <nb_rapports>5</nb_rapports> <marque>Citroën</marque> <modele>Jumper</modele> <energie>diesel</energie> <couleur>gris</couleur> <boite_de_vitesse>manuelle</boite_de_vitesse> <version>35 L3H2 HDI 120 CONFORT</version> <ordinateur_de_bord>1</ordinateur_de_bord> <vitres_electriques>1</vitres_electriques> <climatisation>oui</climatisation> <abs>1</abs> </vehicule> <offre> <carnet_entretien>1</carnet_entretien> <prix>9990</prix> <garantie>6</garantie> <prix_precision>ferme</prix_precision> <controle_technique>OK</controle_technique> <garantie_libelle>Ct securite</garantie_libelle> </offre> </annonce>
Modifié le 23 août 2022 à 13:20
Tu ne nous as toujours pas indiqué quel était le souci exactement .....
Mais d'après ce que je vois, je pense que tu la structure du xml pour les annonces immo n'est pas tout à fait identique à celui des véhicules.. et par conséquent, il serait plus simple de recréer un scipt en partant de 0 plutôt que d'essayer de bidouiller un script (surtout si on n'en comprend pas le fonctionnement... )
En gros.. tu pourrais partir de ça .. puis l'adapter à tes besoins
$content = file_get_contents($file); $xml = simplexml_load_string($content); // Le retour d'Ubiflow n'est pas un XML valide if (!$xml) { echo "<br> ----> Erreur lors du chargement du fichier XML." . PHP_EOL; } $annonces = $xml->annonce; // Compteur d'annonces $i = 1; // On traite annonce par annonce echo "<br><h3>Nombre d'annonces :" . count($annonces) . "</h3><br>" . PHP_EOL; foreach ($annonces as $annonce) { $i++; $prenom = (string) $annonce->contact_a_afficher[0]; $email = (string) $annonce->email_a_afficher[0]; $tel = (string) $annonce->telephone_a_afficher[0]; $ubiflow_ref = (string) $annonce->reference[0]; $announce_id = (string) $annonce->attributes()->id; $name = isset($annonce->titre[0]) ? (string) $annonce->titre[0] : null; $vehicule = $annonce->vehicule[0]; $offre = $annonce->offre[0]; //infos véhicule $code_type = (string) $vehicule->code_type[0]; $code_postal = (string) $vehicule->code_postal[0]; $ville = (string) $vehicule->ville[0]; $pays = (string) $vehicule->pays[0]; $carrosserie = (string) $vehicule->carrosserie[0]; $marque = (string) $vehicule->marque[0]; $modele = (string) $vehicule->modele[0]; $mise_en_circulation = isset($vehicule->mise_en_circulation[0]) ? (string) $vehicule->mise_en_circulation[0] : null; $millesime = (string) $vehicule->millesime[0]; $kilometrage = (string) $vehicule->kilometrage[0]; $puissance_reelle = (string) $vehicule->puissance_reelle[0]; $puissance_fiscale = (string) $vehicule->puissance_fiscale[0]; $nb_places = (string) $vehicule->nb_places[0]; $nb_rapports = (string) $vehicule->nb_rapports[0]; $emission_co2 = (string) $vehicule->emission_co2[0]; $energie = (string) $vehicule->energie[0]; $couleur = (string) $vehicule->couleur[0]; $cylindree = (string) $vehicule->cylindree[0]; $nb_cylindres = (string) $vehicule->nb_cylindres[0]; $disposition_cylindres = (string) $vehicule->disposition_cylindres[0]; $couleur_precision = (string) $vehicule->couleur_precision[0]; $interieur = (string) $vehicule->interieur[0]; $interieur_couleur = (string) $vehicule->interieur_couleur[0]; $boite_de_vitesse = (string) $vehicule->boite_de_vitesse[0]; $etat = (string) $vehicule->etat[0]; $premiere_main = (string) $vehicule->premiere_main[0]; $nb_portes = (string) $vehicule->nb_portes[0]; $kilometrage_garanti = (string) $vehicule->kilometrage_garanti[0]; $numero_immatriculation = (string) $vehicule->numero_immatriculation[0]; $numero_serie = (string) $vehicule->numero_serie[0]; $vehicule_societe = (string) $vehicule->vehicule_societe[0]; $version = (string) $vehicule->version[0]; $puissance_kw = (string) $vehicule->puissance_kw[0]; $couleur_brute = (string) $vehicule->couleur_brute[0]; $classe_critair = (string) $vehicule->classe_critair[0]; $accoudoir_central = isset($vehicule->accoudoir_central[0]) ? (string) $vehicule->accoudoir_central[0] : NULL; $affichage_tete_haute = isset($vehicule->affichage_tete_haute[0]) ? (string) $vehicule->affichage_tete_haute[0] : NULL; $allumage_automatique_des_feux = isset($vehicule->allumage_automatique_des_feux[0]) ? (string) $vehicule->allumage_automatique_des_feux[0] : NULL; $banquette_1_3_2_3 = isset($vehicule->banquette_1_3_2_3[0]) ? (string) $vehicule->banquette_1_3_2_3[0] : NULL; $detecteur_de_pluie = isset($vehicule->detecteur_de_pluie[0]) ? (string) $vehicule->detecteur_de_pluie[0] : NULL; $fermeture_centralisee = isset($vehicule->fermeture_centralisee[0]) ? (string) $vehicule->fermeture_centralisee[0] : NULL; $gps = isset($vehicule->gps[0]) ? (string) $vehicule->gps[0] : NULL; $gps_16_9eme = isset($vehicule->gps_16_9eme[0]) ? (string) $vehicule->gps_16_9eme[0] : NULL; $gps_couleur = isset($vehicule->gps_couleur[0]) ? (string) $vehicule->gps_couleur[0] : NULL; $ordinateur_de_bord = isset($vehicule->ordinateur_de_bord[0]) ? (string) $vehicule->ordinateur_de_bord[0] : NULL; $retroviseurs_rabattables = isset($vehicule->retroviseurs_rabattables[0]) ? (string) $vehicule->retroviseurs_rabattables[0] : NULL; $sieges_sport = isset($vehicule->sieges_sport[0]) ? (string) $vehicule->sieges_sport[0] : NULL; $predisposition_telephone = isset($vehicule->predisposition_telephone[0]) ? (string) $vehicule->predisposition_telephone[0] : NULL; $volant_multifonctions = isset($vehicule->volant_multifonctions[0]) ? (string) $vehicule->volant_multifonctions[0] : NULL; $volant_reglable = isset($vehicule->volant_reglable[0]) ? (string) $vehicule->volant_reglable[0] : NULL; $bluetooth = isset($vehicule->bluetooth[0]) ? (string) $vehicule->bluetooth[0] : NULL; $aide_au_demarrage_en_pente = isset($vehicule->aide_au_demarrage_en_pente[0]) ? (string) $vehicule->aide_au_demarrage_en_pente[0] : NULL; $accoudoir_central_arriere = isset($vehicule->accoudoir_central_arriere[0]) ? (string) $vehicule->accoudoir_central_arriere[0] : NULL; $prise_audio_usb = isset($vehicule->prise_audio_usb[0]) ? (string) $vehicule->prise_audio_usb[0] : NULL; $usb = isset($vehicule->usb[0]) ? (string) $vehicule->usb[0] : NULL; $cd = isset($vehicule->cd[0]) ? (string) $vehicule->cd[0] : NULL; $mp3 = isset($vehicule->mp3[0]) ? (string) $vehicule->mp3[0] : NULL; $prise_audio_aux = isset($vehicule->prise_audio_aux[0]) ? (string) $vehicule->prise_audio_aux[0] : NULL; $possede_auto_radio = isset($vehicule->possede_auto_radio[0]) ? (string) $vehicule->possede_auto_radio[0] : NULL; $climatisation_multi_zone = isset($vehicule->climatisation_multi_zone[0]) ? (string) $vehicule->climatisation_multi_zone[0] : NULL; $auto_radio = isset($vehicule->auto_radio[0]) ? (string) $vehicule->auto_radio[0] : NULL; $climatisation = isset($vehicule->climatisation[0]) ? (string) $vehicule->climatisation[0] : NULL; $avec_direction_assistee = isset($vehicule->avec_direction_assistee[0]) ? (string) $vehicule->avec_direction_assistee[0] : NULL; $radar_aide_stationnement = isset($vehicule->radar_aide_stationnement[0]) ? (string) $vehicule->radar_aide_stationnement[0] : NULL; $abs = isset($vehicule->abs[0]) ? (string) $vehicule->abs[0] : NULL; $airbags_frontaux = isset($vehicule->airbags_frontaux[0]) ? (string) $vehicule->airbags_frontaux[0] : NULL; $airbags_lateraux = isset($vehicule->airbags_lateraux[0]) ? (string) $vehicule->airbags_lateraux[0] : NULL; $anti_demarrage = isset($vehicule->anti_demarrage[0]) ? (string) $vehicule->anti_demarrage[0] : NULL; $anti_patinage = isset($vehicule->anti_patinage[0]) ? (string) $vehicule->anti_patinage[0] : NULL; $controle_pression_des_pneus = isset($vehicule->controle_pression_des_pneus[0]) ? (string) $vehicule->controle_pression_des_pneus[0] : null; $esp = isset($vehicule->esp[0]) ? (string) $vehicule->esp[0] : null; $frein_parking_automatique = isset($vehicule->frein_parking_automatique[0]) ? (string) $vehicule->frein_parking_automatique[0] : null; $phares_antibrouillard = isset($vehicule->phares_antibrouillard[0]) ? (string) $vehicule->phares_antibrouillard[0] : null; $projecteurs_xenon = isset($vehicule->projecteurs_xenon[0]) ? (string) $vehicule->projecteurs_xenon[0] : null; $suspension_sport = isset($vehicule->suspension_sport[0]) ? (string) $vehicule->suspension_sport[0] : null; $radar_obstacle_arriere = isset($vehicule->radar_obstacle_arriere[0]) ? (string) $vehicule->radar_obstacle_arriere[0] : null; $afu = isset($vehicule->afu[0]) ? (string) $vehicule->afu[0] : NULL; $airbags_rideaux = isset($vehicule->airbags_rideaux[0]) ? (string) $vehicule->airbags_rideaux[0] : NULL; $retroviseur_interieur_electrochrome = isset($vehicule->retroviseur_interieur_electrochrome[0]) ? (string) $vehicule->retroviseur_interieur_electrochrome[0] : NULL; $roue_secours = isset($vehicule->roue_secours[0]) ? (string) $vehicule->roue_secours[0] : NULL; $feux_de_circulation_diurne = isset($vehicule->feux_de_circulation_diurne[0]) ? (string) $vehicule->feux_de_circulation_diurne[0] : NULL; $phares_antibrouillard_arrieres = isset($vehicule->phares_antibrouillard_arrieres[0]) ? (string) $vehicule->phares_antibrouillard_arrieres[0] : NULL; $direction_assistee = isset($vehicule->direction_assistee[0]) ? (string) $vehicule->direction_assistee[0] : NULL; $equipements = isset($vehicule->equipements[0]) ? (string) $vehicule->equipements[0] : NULL; //ici .. faire le traitement de ton choix... //.. }//fin du for
Avec ça, tu récupères chaque variable possible dans ubiflow .. à toi ensuite d'en faire ce que tu veux ( comme l'importer en bdd )
Et si il manque des infos... tout est dans la documentation ubiflow...
23 août 2022 à 13:09
Merci de votre réponse.
Je test sa dès se soir.
Cordialement
27 août 2022 à 10:39
Bonjour, je pense avoir presque réussi .
J'obtient une erreur quand je lance le cron :
Parse error: syntax error, unexpected ';', expecting ')' in /home/c1917476c/public_html/jetrouvetous.fr/phpsvr/ubiflow_service_auto.php on line 171
Voici mon code :
$fields_opt = array($carrosserie; $marque; $millesime; $kilometrage; $energie; $couleur; $boite_de_vitesse; $puissance_fiscale);
auriez vous une idée ? ou ais je oublié quelque chose ?
Merci d'avance.
Cdlt
27 août 2022 à 11:21
oui.. le point virgule sert à iniquer la fin d'une intruction..
Dans un array.. il faut utiliser les virgules.
27 août 2022 à 21:03
Bonsoir, merci de ta réponse mais avec la , j'obtient la même erreur .
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author jetrouvetous * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_service_auto($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_auto = getRegionByCp($departement); $reg = $location_auto['region']; $county = $location_auto['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "K": $cat_typ = "Voitures"; $id_cat = 21; break; case "B": $cat_typ = "Moto"; $id_cat = 22; break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $marque, $millesime, $kilometrage, $energie, $couleur, $boite_de_vitesse, $puissance_fiscale), $fields_opt = implode('|' , $fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } } else { $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
Merci
27 août 2022 à 21:24
Dans l'array il faut bien mettre des virgules par contre... Pour finir la ligne il faut bien un point virgule
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question27 août 2022 à 22:57
Bon, je vais voir si je trouve quelqu'un qui pourra mettre les mains dedans ou autre car la je tombe toujours sur la même erreur:
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author jetrouvetous * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_service_auto($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_auto = getRegionByCp($departement); $reg = $location_auto['region']; $county = $location_auto['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "K": $cat_typ = "Voitures"; $id_cat = 21; break; case "B": $cat_typ = "Moto"; $id_cat = 22; break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $marque, $millesime, $kilometrage, $energie, $couleur, $boite_de_vitesse, $puissance_fiscale); $fields_opt = implode('|' , $fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } } else { $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
voici toujours la même erreur
Parse error : erreur de syntaxe, ';' inattendu, ')' attendu dans /home/c1917476c/public_html/jetrouvetous.fr/phpsvr/ubiflow_service_auto.php à la ligne 171
sur ma passerelle immo qui est casi la même je rajoute des options et tous fonctionne.
28 août 2022 à 08:46
Bonjour,
Sur une ligne au-dessus: 167 il y a '}' en trop.
Bon dimanche à tous.
28 août 2022 à 09:27
Bonjour, merci à toi mais malheureusement cela ne change rien.
Cordialement
28 août 2022 à 11:06
Donc, si tu supprime la ligne 167 , la même erreur se produit bien maintenant sur la ligne 170 ?
(il peut arriver de travailler sur le mauvais fichier).
Si oui essaye de simplifier provisoirement la ligne qui pose problème.
28 août 2022 à 11:45
Bonjour, merci à toi j'ai enlevé la ligne etc tjr le même soucis je vais voir sur des autres fichiers au cas.
Jai un fichier sur l'extension fichier je vais chercher pour l'ouvrir je ne sais pas si sa peut venir de la.
Cordialement
28 août 2022 à 14:52
Grâce a votre aide je pense avoir réussi a corriger le soucis mais sa m'ouvre un autre problème .
Parse error : erreur de syntaxe, 'else' inattendu (T_ELSE) dans /home/c1917476c/public_html/jetrouvetous.fr/phpsvr/ubiflow_service_auto.php à la ligne 330
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_auto($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_auto = getRegionByCp($departement); $reg = $location_auto['region']; $county = $location_auto['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": $cat_typ = "vehicule"; $id_cat = 21; $millesime = ($row->bien->millesime); if (!empty($millesime)){ if ($millesime > 1970 ){ $type_de_vente = implode('=',array(29 , "NEUF")); }else{ $type_de_vente = implode('=',array(29 , "OCCASION")); } }else{ $type_de_vente = ''; } break; case "M": $id_cat = 21; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "4X4": $type_bien = implode('=',array(50 , "4X4")); break; case "Berline": $type_bien = implode('=',array(50 , "Berline")); break; case "Break": $type_bien = implode('=',array(50 , "Break")); break; case "Cabriolet": $type_bien = implode('=',array(50 , "Cabriolet")); break; case "Coupé Sport": $type_bien = implode('=',array(50 , "Coupé Sport")); break; case "Citadine": $type_bien = implode('=',array(50 , "Citadine")); break; case "Monospace": $type_bien = implode('=',array(50 , "Monospace")); break; case "Pick-up": $type_bien = implode('=',array(50 , "Pick-up")); break; case "Luxe": $type_bien = implode('=',array(50 , "Luxe")); break; case "Sans permis": $type_bien = implode('=',array(50 , "Sans permis")); break; case "Voiture de société, commerciale": $type_bien = implode('=',array(50 , "Voiture de société, commerciale")); break; case "Voiture sans permis": $type_bien = implode('=',array(50 , "Voiture sans permis")); break; case "Accessoires et pièces": $type_bien = implode('=',array(50 , "Accessoires et pièces")); break; case "Autre": $type_bien = implode('=',array(50 , "Autre")); break; default: $type_bien = implode('=',array(50 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $marque, $millesime, $kilometrage, $energie, $couleur, $boite_de_vitesse, $puissance_fiscale); $fields_opt = implode('|' , $fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)) { $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } } else { $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
Pourriez vous me guider svp ?
J'ai supprimer ou rajouter des } mais la c du chinois pour moi lol
31 août 2022 à 13:34
Bonjour tout le monde.
Juste savoir si quelqu'un pourrait juste mettre le nez dedans svp pour me guider ?
Je suis les tutos même ceux sur le net mais rien ni fait.
Sachant que j'ai copier la passerelle IMMO et j'ai juste changé les balises et je n'ai pas de problème.
Cordialement
6 sept. 2022 à 08:56
Bonjour, comment allez vous ?
Je pense avoir réussi à résoudre mon problème grâce à vous, mais je crois avoir fait une autre erreur pfff.
Quand je lance mon cron pour appeler le fichier sa se charge mais la page reste vierge et rien ne s'ajoute au site.
Quelqu'un aurait une idée svp.
Big merci
6 sept. 2022 à 09:02
Bonjour,
Au lieu de le lancer via cron .. exécute le directement soit en ligne de commandes si tu peux.. soit dans le navigateur.
Pense à activer l'affichage des erreurs PHP au début de ton script et n'hésites pas à ajouter du debug ( des echo / var_dump .. dans ton script pour voir où il passe et les valeurs des éventuelles variables.)
Regarde ensuite ce que ça donne.
Pense aussi à regarder les logs d'erreur apache au cas où.
12 sept. 2022 à 11:13
Slt je suis obligé de passer par le cron il y a mon xml dedans.
J'ai modifié le fichier sa l'appel mais ne s'ajoute.
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " ); $user_id = $result_user['id']; if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
Quelqu'un aurait une idée svp ?
Merci à vous.
Cordialement
12 sept. 2022 à 11:54
Bonjour,
Oui... appliquer ce qui est indiqué dans ma précédente réponse :
12 sept. 2022 à 15:04
Slt aurais tu un code a mettre au début de mon script pour voir les erreurs stp ?
Je cherche sur le net mais rien ne s'affiche .
Meri
Cdlt
12 sept. 2022 à 16:29
13 sept. 2022 à 21:10
Slt j'aurais besoin de tes lumières stp
voici le code que j'ai peu faire et mis les codes pour afficher les erreurs comme vous m'avez indiquer et rien ne s'affiche et mon hebergeur me dit qu'il n'y a pas d'erreur pour cela que rien ne s'affiche (display-errors est activé)
Auriez vous une autre idées svp car ne s'ajoute a mon site .
Au passage si quelqu'un si connais pourrait voir en direct svp .
Merci
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " ); $user_id = $result_user['id']; if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
13 sept. 2022 à 22:29
Que contient ta fonction insert ? (le code de cette fonction ) ?
$dbb->insert(...
Si c'est du PDO, as tu activé l'affichage des erreurs tel que je te l'ai demandé ?
As tu essayé" de placer des ECHO à différents endroits de ton script pouvoir si il se passe quelque chose ?
As tu pu récupérer le fichier de log d'erreur apache du serveur ? (juste après avoir lancé ce script.. ) pour voir les eventuelles erreurs ?
14 sept. 2022 à 15:37
Bonjour, merci de ta réponse.
Je ne sais pas ou mettre les ECHO .
Voici se que mon hébergeur ma transmis.
<textarea id="error_log-errors" class="form-control" cols="120" rows="10" readonly="">[Wed Sep 14 15:28:40.176402 2022] [core:info] [pid 4072713:tid 46953446708992] [client 88.120.46.135:44466] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/zadsmobicon.png, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.348282 2022] [core:info] [pid 4072713:tid 46953450911488] [client 88.120.46.135:58050] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-1246147727.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.347371 2022] [core:info] [pid 4072709:tid 46953450911488] [client 88.120.46.135:44990] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320819-338095550.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.340692 2022] [core:info] [pid 644519:tid 46953410987776] [client 88.120.46.135:44992] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320819-1126437348.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.340504 2022] [core:info] [pid 4072716:tid 46953434101504] [client 88.120.46.135:44996] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320819-1825793188.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.320742 2022] [core:info] [pid 4072716:tid 46953632511744] [client 88.120.46.135:44374] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-942929840.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.320447 2022] [core:info] [pid 4072716:tid 46953434101504] [client 88.120.46.135:44996] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-1196198962.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.318853 2022] [core:info] [pid 4072709:tid 46953450911488] [client 88.120.46.135:44990] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-1808970549.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.318127 2022] [core:info] [pid 499952:tid 46953440405248] [client 88.120.46.135:44718] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660921240-1643649912.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.315827 2022] [core:info] [pid 4072716:tid 46953632511744] [client 88.120.46.135:44374] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-888256328.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:28:39.315770 2022] [core:info] [pid 644519:tid 46953448810240] [client 88.120.46.135:40946] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660320818-1811507120.jpg, referer: https://www.jetrouvetous.fr/annonces/204058/- [Wed Sep 14 15:09:52.003111 2022] [core:info] [pid 644315:tid 46953630410496] [client 114.119.146.206:54126] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/67730, referer: https://www.jetrouvetous.fr/annonces/67730/creysse-maison-mitoyenne-de-105-m2-avec-garage-et-joli-jardin [Wed Sep 14 15:01:05.152197 2022] [core:info] [pid 4072707:tid 46953427797760] [client 54.36.148.125:46756] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonce/Bourgogne-Franche-Comte-Saone-et-Loire-Ventes-immobilieres-Appartement-en-pierre-a-Champforgeuil-737946 [Wed Sep 14 14:58:21.051985 2022] [core:info] [pid 4072885:tid 46953432000256] [client 114.119.146.208:41428] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/52353, referer: https://www.jetrouvetous.fr/annonces/52353/a-saisir-fond-de-commerce-sur-plan-de-campagne-13480- [Wed Sep 14 14:46:41.015440 2022] [core:info] [pid 4072709:tid 46953406785280] [client 114.119.146.208:53278] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/63673, referer: https://www.jetrouvetous.fr/annonces/63673/bergerac-maison-de-ville-de-109-m2-avec-jardin-et-emplacement [Wed Sep 14 14:40:56.759107 2022] [core:info] [pid 4079107:tid 46953446708992] [client 114.119.146.215:38626] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/66389, referer: https://www.jetrouvetous.fr/annonces/66389/castelnau-de-medoc-maison-d-habitation-110-m-parcelle-698 [Wed Sep 14 14:29:30.082114 2022] [core:info] [pid 4072713:tid 46953413089024] [client 114.119.146.226:56230] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/84121, referer: https://www.jetrouvetous.fr/annonces/84121/appartement [Wed Sep 14 14:28:45.147628 2022] [core:info] [pid 4073308:tid 46953419392768] [client 172.70.162.141:46200] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/zadsmobicon.png, referer: https://www.jetrouvetous.fr/annonces/94951/- [Wed Sep 14 14:23:47.408441 2022] [core:info] [pid 4073466:tid 46953432000256] [client 114.119.146.208:44940] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/234675, referer: https://www.jetrouvetous.fr/annonces/234675/eybens-t4-r-sidence-haut-de-gamme [Wed Sep 14 14:07:04.639351 2022] [core:info] [pid 4073308:tid 46953408886528] [client 54.36.148.121:54750] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-studio-avec-chambre-62f67c32638c4347970f4492-1660921240-1643649912.jpg [Wed Sep 14 14:07:04.169670 2022] [core:info] [pid 4072709:tid 46953442506496] [client 54.36.148.112:59606] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-2-pieces-loue-630cc091638c435c0d791544-1652990202-1295854212.jpg [Wed Sep 14 14:07:03.469901 2022] [core:info] [pid 4072716:tid 46953408886528] [client 54.36.148.61:58982] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-4-pieces-630cc234638c435cda522c6d-1659450215-805680056.jpg [Wed Sep 14 14:07:02.704579 2022] [core:info] [pid 4072885:tid 46953406785280] [client 54.36.148.172:59602] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-3-pieces-630cc10c638c435cd9313ba4-1659448820-1429493108.jpg [Wed Sep 14 14:07:02.626690 2022] [core:info] [pid 4072709:tid 46953425696512] [client 54.36.148.92:58980] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_maison-4-pieces-630ca701638c434854568e53-1657872557-1809685592.jpg [Wed Sep 14 14:07:01.916290 2022] [core:info] [pid 4072713:tid 46953442506496] [client 54.36.148.131:58150] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_studio-etudiant-amiens-25m2-st-honore-avec-cour-62f3bfa4638c4352886a6294-1660912849-179577897.jpg [Wed Sep 14 14:07:01.703826 2022] [core:info] [pid 4073308:tid 46953417291520] [client 54.36.149.60:58990] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_charmante-maison-3-chambres-et-terrain-a-moreuil-62f55002638c43748d2cd4a2-1660243970-2071601542.jpg [Wed Sep 14 14:07:01.542326 2022] [core:info] [pid 4072713:tid 46953419392768] [client 54.36.148.23:58988] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-immeuble-de-rapport-proche-gare-6315e865638c4339ce14f4f5-1662380133-1174810662.jpg [Wed Sep 14 14:00:48.183057 2022] [core:info] [pid 4072709:tid 46953410987776] [client 114.119.146.208:49622] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/73255, referer: https://www.jetrouvetous.fr/annonces/73255/terrain-vendre-constructible-anthon-lyon- [Wed Sep 14 13:55:07.468802 2022] [core:info] [pid 4073308:tid 46953429899008] [client 114.119.146.226:59588] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/236732, referer: https://www.jetrouvetous.fr/annonces/236732/propriete-de-361m2-6-chambres-bureau-sur-6082-m2-de-parc [Wed Sep 14 13:54:34.492464 2022] [core:info] [pid 4072713:tid 46953408886528] [client 52.2.74.251:52574] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/sellers.json, referer: https://www.audiencerun.com/sellers.json [Wed Sep 14 13:49:37.058651 2022] [core:info] [pid 3979055:tid 46953410987776] [client 114.119.146.226:51538] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/67692, referer: https://www.jetrouvetous.fr/annonces/67692/a-25-minutes-de-sarlat-maison-de-bourg-avec-jardinet-et-ses [Wed Sep 14 13:45:02.923577 2022] [core:info] [pid 3979055:tid 46953410987776] [client 185.191.171.17:47876] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/203949 [Wed Sep 14 13:43:38.177798 2022] [core:info] [pid 3913997:tid 46953410987776] [client 114.119.146.226:34840] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/91489, referer: https://www.jetrouvetous.fr/annonces/91489/dortoir [Wed Sep 14 13:37:48.064447 2022] [core:info] [pid 3473486:tid 46953453012736] [client 66.249.76.87:42936] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m-62e79504638c4353e910a735-1659344166-1909110365.jpg [Wed Sep 14 13:37:45.803231 2022] [core:info] [pid 3473486:tid 46953419392768] [client 66.249.76.87:42764] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m-62e79504638c4353e910a735-1659344166-763439031.jpg [Wed Sep 14 13:37:42.007285 2022] [core:info] [pid 3533821:tid 46953417291520] [client 66.249.70.61:40478] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m [Wed Sep 14 13:31:56.296903 2022] [core:info] [pid 3747623:tid 46953423595264] [client 114.119.146.226:41840] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/63447, referer: https://www.jetrouvetous.fr/annonces/63447/miramas-appartement-t2-avec-terrasse-vendre [Wed Sep 14 13:21:39.839036 2022] [core:info] [pid 3473176:tid 46953423595264] [client 80.118.64.252:42980] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/zadsmobicon.png [Wed Sep 14 13:21:36.000084 2022] [core:info] [pid 3472519:tid 46953436202752] [client 80.118.64.252:41718] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/apple-touch-icon.png [Wed Sep 14 13:21:35.999269 2022] [core:info] [pid 3473486:tid 46953453012736] [client 80.118.64.252:41714] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/apple-touch-icon-precomposed.png [Wed Sep 14 13:08:43.131439 2022] [core:info] [pid 3472810:tid 46953432000256] [client 114.119.146.226:47294] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/118, referer: https://www.jetrouvetous.fr/vendeur/118/fokwa-joel [Wed Sep 14 13:05:26.288189 2022] [core:info] [pid 3473486:tid 46953410987776] [client 207.46.13.124:49328] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonces/offres/Ile-de-France/Val-d-Oise [Wed Sep 14 13:03:02.703800 2022] [core:info] [pid 3473486:tid 46953434101504] [client 114.119.146.206:45646] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/80239, referer: https://www.jetrouvetous.fr/annonces/80239/t2-meubl-all-e-des-eiders-paris [Wed Sep 14 12:57:17.482537 2022] [core:info] [pid 3374748:tid 46953408886528] [client 114.119.146.219:52812] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/338, referer: https://www.jetrouvetous.fr/boutiques/338/lcn-concept [Wed Sep 14 12:51:29.932805 2022] [core:info] [pid 3375246:tid 46953415190272] [client 114.119.146.226:59668] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/61281, referer: https://www.jetrouvetous.fr/annonces/61281/proche-juvigny-val-d-andaine-maison-renovee-3-pieces-93 [Wed Sep 14 12:45:52.371217 2022] [core:info] [pid 3105048:tid 46953453012736] [client 114.119.146.208:55632] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/417, referer: https://www.jetrouvetous.fr/vendeur/417/hollande-antipas [Wed Sep 14 12:40:01.964878 2022] [core:info] [pid 3105328:tid 46953438304000] [client 114.119.146.219:58408] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/76608, referer: https://www.jetrouvetous.fr/annonces/76608/voiture-sans-permis-aixam-scouty-gtr [Wed Sep 14 12:34:39.776817 2022] [core:info] [pid 3105334:tid 46953632511744] [client 66.249.76.87:55512] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m-62e79504638c4353e910a735-1659344166-520332721.jpg [Wed Sep 14 12:34:12.351484 2022] [core:info] [pid 3105328:tid 46953450911488] [client 54.36.148.43:47070] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/{first_tn_image} [Wed Sep 14 12:28:53.354095 2022] [core:info] [pid 3105833:tid 46953442506496] [client 207.46.13.131:53554] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonce/Ile-de-France-Paris-Locations-Boutique-a-louer-a-proximite-champ-de-mars-736545 [Wed Sep 14 12:17:00.085722 2022] [core:info] [pid 2798502:tid 46953410987776] [client 114.119.146.215:44784] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/67807, referer: https://www.jetrouvetous.fr/annonces/67807/maison-6-pi-ces [Wed Sep 14 11:54:01.961789 2022] [core:info] [pid 2621298:tid 46953442506496] [client 114.119.146.226:46438] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/62572, referer: https://www.jetrouvetous.fr/annonces/62572/maison-de-village [Wed Sep 14 11:48:20.005885 2022] [core:info] [pid 2621303:tid 46953450911488] [client 114.119.146.226:52530] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/61244, referer: https://www.jetrouvetous.fr/annonces/61244/maison-t6-terrain-812-m-proximit-commerces-lac-et [Wed Sep 14 11:44:34.822994 2022] [core:info] [pid 2621308:tid 46953442506496] [client 54.159.192.80:49980] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/sellers.json [Wed Sep 14 11:42:27.644291 2022] [core:info] [pid 2064024:tid 46953442506496] [client 114.119.146.226:35420] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/84205, referer: https://www.jetrouvetous.fr/annonces/84205/agr-able-voiture-sans-permis-citroen-ami [Wed Sep 14 11:36:39.658705 2022] [core:info] [pid 2131415:tid 46953446708992] [client 114.119.146.20:40706] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_1.jpg, referer: https://www.jetrouvetous.fr/departement/reunion?paged=26 [Wed Sep 14 11:28:43.519285 2022] [core:info] [pid 2131415:tid 46953419392768] [client 185.191.171.17:41572] AH00128: File does not exist: /home/c1917476c/public_html/fudme.fr/404.shtml [Wed Sep 14 11:28:43.519040 2022] [core:info] [pid 2131415:tid 46953419392768] [client 185.191.171.17:41572] AH00128: File does not exist: /home/c1917476c/public_html/fudme.fr/robots.txt [Wed Sep 14 11:25:35.028798 2022] [core:info] [pid 2155867:tid 46953432000256] [client 66.249.76.87:49422] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_confortable-maison-de-6-pieces-630cc293638c435cd9313bd6-1659517218-1936274036.jpg [Wed Sep 14 11:25:08.052806 2022] [core:info] [pid 2064289:tid 46953417291520] [client 114.119.146.226:58638] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/76080, referer: https://www.jetrouvetous.fr/annonces/76080/appartement-2-pi-ces [Wed Sep 14 11:02:06.247340 2022] [core:info] [pid 2064294:tid 46953427797760] [client 114.119.146.20:41680] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_1.jpg, referer: https://www.jetrouvetous.fr/ville/sigoules [Wed Sep 14 10:52:21.720737 2022] [core:info] [pid 2064027:tid 46953436202752] [client 54.36.148.133:59328] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/41024 [Wed Sep 14 10:45:08.671160 2022] [core:info] [pid 751447:tid 46953438304000] [client 114.119.146.226:57698] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/421, referer: https://www.jetrouvetous.fr/vendeur/421/fadonougbo-vigninou [Wed Sep 14 10:34:12.774728 2022] [core:info] [pid 751447:tid 46953453012736] [client 114.119.146.215:40866] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/191667, referer: https://www.jetrouvetous.fr/annonces/191667/mauressargues-villa-plain-pied-125m2-4chs-piscine-et-2-g [Wed Sep 14 10:27:52.311065 2022] [core:info] [pid 556723:tid 46953436202752] [client 114.119.146.208:53846] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_amiens-immeuble-de-rapport-proche-gare-6315e865638c4339ce14f4f5-1662380, referer: https://www.jetrouvetous.fr/annonces/204057/amiens-immeuble-de-rapport-proche-gare [Wed Sep 14 10:21:36.375515 2022] [core:crit] [pid 597694:tid 46953421494016] (13)Permission denied: [client 114.119.146.206:35812] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/annonces/80222/vsp-aixam-city-s8-voiturette-a-donner [Wed Sep 14 10:21:36.375368 2022] [core:crit] [pid 597694:tid 46953421494016] (13)Permission denied: [client 114.119.146.206:35812] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/annonces/80222/vsp-aixam-city-s8-voiturette-a-donner [Wed Sep 14 10:20:35.889627 2022] [core:crit] [pid 757730:tid 46953413089024] (13)Permission denied: [client 66.249.76.91:38084] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:20:35.889483 2022] [core:crit] [pid 757730:tid 46953413089024] (13)Permission denied: [client 66.249.76.91:38084] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:19:34.359432 2022] [core:crit] [pid 751447:tid 46953413089024] (13)Permission denied: [client 66.249.76.89:40990] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:19:34.359273 2022] [core:crit] [pid 751447:tid 46953413089024] (13)Permission denied: [client 66.249.76.89:40990] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:18:48.166731 2022] [core:crit] [pid 524463:tid 46953425696512] (13)Permission denied: [client 66.249.76.87:48662] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:18:48.166577 2022] [core:crit] [pid 524463:tid 46953425696512] (13)Permission denied: [client 66.249.76.87:48662] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:16:01.256210 2022] [core:crit] [pid 524463:tid 46953444607744] (13)Permission denied: [client 114.119.146.206:55584] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/vendeur/216/annonces [Wed Sep 14 10:16:01.256122 2022] [core:crit] [pid 524463:tid 46953444607744] (13)Permission denied: [client 114.119.146.206:55584] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/vendeur/216/annonces [Wed Sep 14 10:15:39.173435 2022] [core:crit] [pid 1203584:tid 46953442506496] (13)Permission denied: [client 54.36.148.33:46990] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:39.173260 2022] [core:crit] [pid 1203584:tid 46953442506496] (13)Permission denied: [client 54.36.148.33:46990] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.226674 2022] [core:crit] [pid 751447:tid 46953438304000] (13)Permission denied: [client 66.249.93.75:40314] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.226447 2022] [core:crit] [pid 751447:tid 46953438304000] (13)Permission denied: [client 66.249.93.75:40314] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.077017 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.79:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.076913 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.79:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.070075 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.79:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.069954 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.79:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.066698 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.066591 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.060335 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.060240 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.059820 2022] [core:crit] [pid 595224:tid 46953423595264] (13)Permission denied: [client 66.249.93.79:40402] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.059708 2022] [core:crit] [pid 595224:tid 46953423595264] (13)Permission denied: [client 66.249.93.79:40402] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.059689 2022] [core:crit] [pid 751447:tid 46953632511744] (13)Permission denied: [client 66.249.93.75:40404] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.059574 2022] [core:crit] [pid 751447:tid 46953632511744] (13)Permission denied: [client 66.249.93.75:40404] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.058616 2022] [core:crit] [pid 597694:tid 46953436202752] (13)Permission denied: [client 66.249.93.77:40386] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.058466 2022] [core:crit] [pid 597694:tid 46953436202752] (13)Permission denied: [client 66.249.93.77:40386] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057351 2022] [core:crit] [pid 751447:tid 46953632511744] (13)Permission denied: [client 66.249.93.79:40404] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057322 2022] [core:crit] [pid 595224:tid 46953423595264] (13)Permission denied: [client 66.249.93.75:40402] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057224 2022] [core:crit] [pid 751447:tid 46953632511744] (13)Permission denied: [client 66.249.93.79:40404] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057212 2022] [core:crit] [pid 595224:tid 46953423595264] (13)Permission denied: [client 66.249.93.75:40402] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057143 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.057011 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.75:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.056263 2022] [core:crit] [pid 597694:tid 46953436202752] (13)Permission denied: [client 66.249.93.77:40386] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.056143 2022] [core:crit] [pid 597694:tid 46953436202752] (13)Permission denied: [client 66.249.93.77:40386] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.055890 2022] [core:crit] [pid 772260:tid 46953425696512] (13)Permission denied: [client 66.249.93.77:40382] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.055731 2022] [core:crit] [pid 772260:tid 46953425696512] (13)Permission denied: [client 66.249.93.77:40382] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.054483 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.77:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:15:21.054347 2022] [core:crit] [pid 1203584:tid 46953630410496] (13)Permission denied: [client 66.249.93.77:40360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:14:30.652073 2022] [core:crit] [pid 597694:tid 46953446708992] (13)Permission denied: [client 66.249.76.87:54586] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:14:30.651950 2022] [core:crit] [pid 597694:tid 46953446708992] (13)Permission denied: [client 66.249.76.87:54586] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:12:55.966755 2022] [core:crit] [pid 772260:tid 46953410987776] (13)Permission denied: [client 92.226.2.139:58782] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:12:55.966601 2022] [core:crit] [pid 772260:tid 46953410987776] (13)Permission denied: [client 92.226.2.139:58782] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:11:49.942203 2022] [core:crit] [pid 757730:tid 46953413089024] (13)Permission denied: [client 66.249.76.87:43042] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:11:49.942114 2022] [core:crit] [pid 757730:tid 46953413089024] (13)Permission denied: [client 66.249.76.87:43042] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:11:11.429620 2022] [core:crit] [pid 597694:tid 46953453012736] (13)Permission denied: [client 54.36.149.59:34828] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:11:11.429469 2022] [core:crit] [pid 597694:tid 46953453012736] (13)Permission denied: [client 54.36.149.59:34828] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:10:18.972874 2022] [core:crit] [pid 751447:tid 46953406785280] (13)Permission denied: [client 114.119.146.215:49234] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/vendeur/356/annonces [Wed Sep 14 10:10:18.972768 2022] [core:crit] [pid 751447:tid 46953406785280] (13)Permission denied: [client 114.119.146.215:49234] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable, referer: https://www.jetrouvetous.fr/vendeur/356/annonces [Wed Sep 14 10:09:22.505277 2022] [core:crit] [pid 524463:tid 46953434101504] (13)Permission denied: [client 66.249.76.89:37338] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:09:22.505151 2022] [core:crit] [pid 524463:tid 46953434101504] (13)Permission denied: [client 66.249.76.89:37338] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:08:56.529749 2022] [core:crit] [pid 597694:tid 46953440405248] (13)Permission denied: [client 193.51.224.133:57426] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:08:56.529651 2022] [core:crit] [pid 597694:tid 46953440405248] (13)Permission denied: [client 193.51.224.133:57426] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:08:03.772296 2022] [core:crit] [pid 556723:tid 46953421494016] (13)Permission denied: [client 66.249.70.59:49360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:08:03.772199 2022] [core:crit] [pid 556723:tid 46953421494016] (13)Permission denied: [client 66.249.70.59:49360] AH00529: /home/c1917476c/public_html/jetrouvetous.fr/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/c1917476c/public_html/jetrouvetous.fr/' is executable [Wed Sep 14 10:05:33.538274 2022] [core:info] [pid 597694:tid 46953421494016] [client 149.56.160.144:43498] AH00128: File does not exist: /home/c1917476c/public_html/yaax.site/robots.txt [Wed Sep 14 10:04:55.585741 2022] [core:info] [pid 597694:tid 46953429899008] [client 157.55.39.33:56778] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonce/Occitanie-Haute-Garonne-Chiens-Chats-Chevaux-Tres-beau-chaton-nu-sans-poils-sphynx-736238 [Wed Sep 14 10:03:31.300853 2022] [core:info] [pid 757730:tid 46953423595264] [client 66.249.76.87:35404] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m-62e79504638c4353e910a735-1659344166-518976354.jpg [Wed Sep 14 10:00:56.878069 2022] [core:info] [pid 597694:tid 46953421494016] [client 157.55.39.33:47618] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonce/Nouvelle-Aquitaine-Pyrenees-Atlantiques-Ventes-immobilieres-Propriete-dans-un-ecrin-vert-d-un-1-ha-3550-m2-737089 [Wed Sep 14 10:00:28.071961 2022] [core:info] [pid 751447:tid 46953425696512] [client 66.249.76.87:36504] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-1-piece-15-m-62e79504638c4353e910a735-1659344166-644869217.jpg [Wed Sep 14 09:58:43.266175 2022] [core:info] [pid 751447:tid 46953429899008] [client 114.119.146.206:37106] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/uploads/img/notn_appartement-t2-62e7fb6b638c4323ce697344-1659370347-1356775593.jpg, referer: https://www.jetrouvetous.fr/vendeur/398/annonces [Wed Sep 14 09:53:32.454884 2022] [core:info] [pid 772260:tid 46953421494016] [client 114.119.146.206:33788] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/73585, referer: https://www.jetrouvetous.fr/annonces/73585/maison-en-pierres-t8-230-m-6-chambres-1-loft-640-m- [Wed Sep 14 09:44:58.779827 2022] [core:info] [pid 1203584:tid 46953427797760] [client 207.46.13.131:44480] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/template/images/no_photo2.png [Wed Sep 14 09:36:10.225610 2022] [core:info] [pid 556723:tid 46953446708992] [client 88.162.108.32:50576] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/503.shtml [Wed Sep 14 09:31:57.843763 2022] [core:info] [pid 772260:tid 46953421494016] [client 207.46.13.131:60982] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/annonces/offres/Occitanie/Haute-Garonne/Chiens-Chats-Chevaux [Wed Sep 14 09:30:10.589001 2022] [core:info] [pid 255694:tid 46953425696512] [client 114.119.146.220:40280] AH00128: File does not exist: /home/c1917476c/public_html/jetrouvetous.fr/36986, referer: https://www.jetrouvetous.fr/annonces/36986/chemise-en-jeans-bleu-marine </textarea>
Merci
14 sept. 2022 à 20:01
Bonsoir qui serait ouvrir un fichier de type fichier ? que je puisse voir si mon soucis ne vient pas de la .
Ou me dire quoi prendre pour l'ouvrir svp
Merci d'avance
14 sept. 2022 à 21:04
Quand on regarde ton code, on y voit 3 fonctions .... mais... à quel moment les appelles tu ?
14 sept. 2022 à 22:10
Je les appelle quand je lance mes cron vu que les flux xml sont dans mes crons
14 sept. 2022 à 22:12
Comment appelles tu une fonction de ce fichier dans un cron ?
Tu as un autre script qui fait appelle à celui là ?
15 sept. 2022 à 11:19
Sur celui là non et oui le XML qui importe les annonces est dans le fichier cron comme pour les annonces immobilières et sa fonctionne.
Cordialement
15 sept. 2022 à 11:51
comment est paramétré la CRON ?
Quand tu m'as dit : rien ne s'affiche... comment le sais tu ? comment l'as tu testé ?
Comment lances tu ce fichier ? Et comment fais tu appel aux fonctions qui se trouvent dans ton script ?????
15 sept. 2022 à 12:27
Bonjour, merci de ta réponse .
Voici le cron
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ include_once "ubiflow_service_vehicule.php"; //pour ajouter un nouveau lien mettre une virgule /* $urls = array('lien1', 'lien2', 'lien3'); */ $urls = array('url du flux'); foreach($urls as $url) { $result = insert_ubiflow_vehicule($url); $array_id = end($result); $id_ad = implode("; ", $array_id); echo $id_ad; }
et quand je l'appel rien ne s'affiche car normalement sa rentre les annonces dans mon site et ma bdd comme pour l'immo .
Pour le lancer je fait "https://jetrouvetous.fr/phpsvr/ubiflow_cron2.php" ou "https://jetrouvetous.fr/phpsvr/ubiflow_service_vehicule.php"
15 sept. 2022 à 14:58
Tu disais ne rien avoir qui s'affiche sur la page.... pourtant :
{"success":false,"code":500,"message":"500 Internal Server Error","extendedMessage":" ZADSERROR = [256] SQLSTATE[42000] [1226] User 'c1917476c' has exceeded the 'max_user_connections' resource (current value: 3) - Fatal Error on line:225 in file:\/home\/c1917476c\/public_html\/jetrouvetous.fr\/phpsvr\/inc\/db_class.php"}
15 sept. 2022 à 15:36
Moi sa c affiché et tout es normal la trop de connexion en même temps
15 sept. 2022 à 16:40
Dans ta fonction
insert_ubiflow_vehicule
ajoutes un echo au début de celui-ci affichant l'url.
Après, dans le reste du code, ajoute des echo par ci par là de tes variables histoire de voir ce qu'il fait
15 sept. 2022 à 21:03
Slt voici se que j'ai fait je ne sais pas si c'est bon
echo $result = insert_ubiflow_vehicule($url);
et voila se que sa marque " Déployer " quand je lance le cron
15 sept. 2022 à 22:13
Ah la la la.. .. j'ai marqué DANS la fonction ...
Bref
Dans le fichier : "ubiflow_service_vehicule.php"
/////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { echo " URL " . $url; global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
puis vers la ligne 264
$result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; echo " USER ID " . $user_id;
et vers la ligne 324
$fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ;
ça permettra déjà de voir si il rentre bien dans ton script ..
Au passage..c'est étrange de gérer toutes les infos du véhicule dans une variable
'vfields' => $fields_opt
Champ qui a interet à être bien défini ( type longtext vu le nombre d'éléments à y mettre...)
J'aurais plutôt fait une table vehicule .. avec un champ par attribut .. ce qui permettra de plus facilement gérer les véhicules et, si besoin faire des requêtes pour les rechercher ...
Et enfin.. je t'ai déjà demandé ce que contient (le code..) la fonction
$dbb->insert()
16 sept. 2022 à 21:20
Slt voici carrément les deux fichiers qui correspond a
$dbb->insert()
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { echo " URL " . $url; global $dbb; $str = ''; $id_ad = ''; echo "context" . $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); echo "xml" . $xml = file_get_contents($url, false, $context); echo "xml" . $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } echo "array_data" . $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); echo "array_data1" . $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { echo "i" . $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } echo "departement" . $departement = ($row->bien->departement); echo "location_vehicule" . $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " ); $user_id = $result_user['id']; if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' ); echo "result_insert_user". $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); echo "user_id" . $user_id = $result_insert_user['id']; echo " USER ID " . $user_id; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref ); var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ; } //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
et
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ include_once "ubiflow_service_vehicule.php"; //pour ajouter un nouveau lien mettre une virgule /* $urls = array('lien1', 'lien2', 'lien3'); */ $urls = array('https://sw.ubiflow.net/diffusion-annonces.php?MDP_PARTENAIRE=12d96708f3e09f4781e7a47997c6cc5a65e9257e&DIFFUSEUR=JE_TROUVE_TOUS_VO&ANNONCEUR=ag755319'); foreach($urls as $url) { $result = insert_ubiflow_vehicule($url); $array_id = end($result); $id_ad = implode("; ", $array_id); echo $id_ad; }
cette partie la c lui qui la fait et j'ai un fichier sous l'extension fichier ( je ne sais pas comment l'ouvrir pour voir ) et dans un dossier qu'il a creer .
Cdlt
Modifié le 16 sept. 2022 à 21:59
Tu n'as pas bien lu ce que je t'ai marqué...
Dans un des fichiers qui est include dans les deux codes que tu nous montres... Il y a du code qui permet de gérer, manipuler la base de données.
La variable dbb représente une instance de la classe qui sert à manipuler la base.
Dans cet instance, on fait appel à la méthode insert...
Je veux voir le code qui correspond à cette fonction ... l'intérieur de cette fonction pas là où elle est appelée...
16 sept. 2022 à 22:48
Sa doit être celui ci que tu souhaites.
text/x-generic db_class.php ( C++ source, ASCII text ) <?php /****************************************************************************** * ZADS CLASS for managing database accesses * @category Class * @package ZADS * @author Patrice COHAUT <***@***> * @copyright 2016 PATMISC * @version 1.0 * @link https://www.zads.fr * @notes inspired by http://medoo.in/ ******************************************************************************/ // // make a simple call // // $result = $dbb->fetchAll("SELECT * FROM ".DB_PREFIX.DB_TABLE_ITEMS." LIMIT 0, 2"); // // $result2 = $dbb->fetchAll("SELECT * FROM ".DB_PREFIX.DB_TABLE_ITEMS." LIMIT 0, 1"); // return // $result2['nb'] = $count ; // $result2['data']=$xdata ; // // $result = $dbb->fetchAll($query); // if ($result['nb']){ // foreach ($result['data'] as $key => $value) { // } // } // // foreach ($result['data'] as $key => $row){ // $row=(object)$row; // $resultcatfull = $dbb->fetchAll($querycatfull); // $totnbrofresultscat = $resultcatfull['nb']; // $row = (object)$result['data'][0]; /* $resultfull = $dbb->fetchAll($queryfull); $maxresults = $resultfull['nb']; $result = $dbb->fetchAll($query); $totnbrofresults = $result['nb']; foreach ($result['data'] as $key => $row){ $row=(object)$row; */ // $result = $dbb->fetchAll($query); // if ($result['nb']) { // foreach ($result['data'] as $key => $row) { // // get number of items // $result = $dbb->count(DB_TABLE_ITEMS); // $result = $dbb->max(DB_TABLE_ITEMS, 'price'); // $result = $dbb->has(DB_TABLE_USERS, " `username`='admin' "); // ---- get a list of things from a single table // $result = $dbb->get(DB_TABLE_USERS, ["firstname(pat)", "lastname(virg)"] , " `username`='admin' "); // $result = $dbb->select(DB_TABLE_USERS, ["firstname(pat)", "lastname(virg)", "protype"] , " protype='pro' "); // $result = $dbb->select(DB_TABLE_USERS, '*' , " protype='pro' LIMIT 0, 10"); // is some reults : $result=array(array, ...) / else $result = empty array // if (!$result) die('no results'); // $result = $dbb->select(DB_TABLE_USERS, ['id'] , " uid='' "); // --- UPDATE // $result = $dbb->update(DB_TABLE_USERS, ["firstname"=>"patrice", "lastname"=>"cohaut"] , " username='admin' "); // $result : the number of modifified elemens [O - n] // $result = $dbb->update($dbThisTable3, ["moddate"=>$stamp_update2, "status"=>$status] , " id='".$ad_id."' "); // // insert element // $result = $dbb->insert(DB_TABLE_USERS, ["firstname"=>"patrice", "lastname"=>"cohaut"]); // return : the lastid created // $result = $dbb->get(DB_TABLE_USERS, '*' , " id=".$result); // $result = $dbb->get($dbThisTable, [$dbfield], " `$dbfield`='$invalue'"); // --- SIMPLE GET // // $result = $dbb->get(DB_TABLE_USERS, '*' , " `username`='admin' "); // $comid = $result['comid']; // --- DELETE //$result = $dbb->delete($dbThisTable, " `id` = $this_id "); // $reult = INTEGER = number of deleted items // ---- PU CHANGE // if (is_array($fields_list)){ // $result = $dbb->update($dbThisTable, $fields_list, " `id` = $this_id " ); // } else early_die(0, "bad / incorrect fields "); // var_dump($dbb->get_log()); // var_dump($dbb->get_logtime()); class dbClass { // General protected $database_type; protected $charset; protected $database_name; // For MySQL, MariaDB, MSSQL, Sybase, PostgreSQL, Oracle protected $server; protected $username; protected $password; // For SQLite protected $database_file; // For MySQL or MariaDB with unix_socket protected $socket; // Optional protected $port; protected $prefix; protected $option = array(); // Variable protected $logs = array(); protected $debug_mode = false; protected $timing_trace = ''; protected $t0; public function __construct($options = null) { // initialisation $this->t0=microtime(true); try { $commands = array(); $dsn = ''; // options mapping if (is_array($options)) { foreach ($options as $option => $value){ $this->$option = $value; } } else { return false; } if ( isset($this->port) && is_int($this->port * 1) ) { $port = $this->port; } $type = strtolower($this->database_type); $is_port = isset($port); if (isset($options[ 'prefix' ])){ $this->prefix = $options[ 'prefix' ]; } switch ($type) { case 'mariadb': $type = 'mysql'; case 'mysql': if ($this->socket) { $dsn = $type . ':unix_socket=' . $this->socket . ';dbname=' . $this->database_name; } else { $dsn = $type . ':host=' . $this->server . ($is_port ? ';port=' . $port : '') . ';dbname=' . $this->database_name; } // Make MySQL using standard quoted identifier $commands[] = 'SET SQL_MODE=ANSI_QUOTES'; break; case 'pgsql': $dsn = $type . ':host=' . $this->server . ($is_port ? ';port=' . $port : '') . ';dbname=' . $this->database_name; break; case 'sybase': $dsn = 'dblib:host=' . $this->server . ($is_port ? ':' . $port : '') . ';dbname=' . $this->database_name; break; case 'oracle': $dbname = $this->server ? '//' . $this->server . ($is_port ? ':' . $port : ':1521') . '/' . $this->database_name : $this->database_name; $dsn = 'oci:dbname=' . $dbname . ($this->charset ? ';charset=' . $this->charset : ''); break; case 'mssql': $dsn = strstr(PHP_OS, 'WIN') ? 'sqlsrv:server=' . $this->server . ($is_port ? ',' . $port : '') . ';database=' . $this->database_name : 'dblib:host=' . $this->server . ($is_port ? ':' . $port : '') . ';dbname=' . $this->database_name; // Keep MSSQL QUOTED_IDENTIFIER is ON for standard quoting $commands[] = 'SET QUOTED_IDENTIFIER ON'; break; case 'sqlite': $dsn = $type . ':' . $this->database_file; $this->username = null; $this->password = null; break; } if ( in_array($type, array('mariadb', 'mysql', 'pgsql', 'sybase', 'mssql')) && $this->charset ) { $commands[] = "SET NAMES '" . $this->charset . "'"; // $commands[] = " SET collation_connection = 'utf8_general_ci'"; } $this->pdo = new PDO( $dsn, $this->username, $this->password, $this->option ); foreach ($commands as $value) { $this->pdo->exec($value); } } catch (PDOException $e) { // throw new Exception($e->getMessage()); trigger_error($e->getMessage(), E_USER_ERROR); } } // -- end construct public function exec($query) { if ($this->debug_mode) { echo $query; $this->debug_mode = false; return false; } $this->logs[] = $query; $this->logtime('exec start'); try { $q = $this->pdo->exec($query); return $q ; } catch (PDOException $e) { trigger_error($e->getMessage().' query='. $query, E_USER_ERROR); } } //-- essential functions public function query($query) { if ($this->debug_mode) { echo $query; $this->debug_mode = false; return false; } $this->logs[] = $query; $this->logtime('query start'); try { $q = $this->pdo->query($query); return $q ; } catch (PDOException $e) { trigger_error($e->getMessage().' query='. $query, E_USER_ERROR); } } public function fetchAll($query) { $data=array(); $count=0; $xdata=0; $this->logs[] = $query; $sth = $this->pdo->prepare($query); $sth->execute(); $count = $sth->rowCount(); if ($count){ $xdata =$sth->fetchAll(); } $data['nb'] = $count ; $data['data']=$xdata ; $data = $this->logAndTrace($data,array($query)); // add logs and trace to this return $data ; // TRUE if ok. } public function fetch($query) { $data=array(); $count=0; $xdata=0; $this->logs[] = $query; $sth = $this->pdo->prepare($query); $sth->execute(); $count = $sth->rowCount(); if ($count){ $xdata =$sth->fetch(); } $data['nb'] = $count ; $data['data']=$xdata ; $data = $this->logAndTrace($data,array($query)); // add logs and trace to this return $data ; // TRUE if ok. } public function select($table, $columns = null, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; $is_single_column = (is_string($columns) && $columns !== '*'); // $query = $this->query($this->select_context($table, $join, $columns, $where)); $query = $this->query(' SELECT '. $this->column_push($columns).' FROM ' . $this->table_quote($table).$where_clause); $stack = array(); $index = 0; if (!$query) { $out= false; $this->logtime('end'); return $out ; } if ($columns === '*') { $out= $query->fetchAll(PDO::FETCH_ASSOC); $this->logtime('end'); return $out ; } if ($is_single_column) { $out= $query->fetchAll(PDO::FETCH_COLUMN); $this->logtime('end'); return $out ; } while ($row = $query->fetch(PDO::FETCH_ASSOC)) { foreach ($columns as $key => $value) { if (is_array($value)) { $this->data_map($index, $key, $value, $row, $stack); } else { $this->data_map($index, $key, preg_replace('/^[\w]*\./i', "", $value), $row, $stack); } } $index++; } $out= $stack; $this->logtime('end'); return $out ; } public function get($table, $columns = null, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; $is_single_column = (is_string($columns) && $columns !== '*'); $query = $this->query(' SELECT '. $this->column_push($columns).' FROM ' . $this->table_quote($table).$where_clause. ' LIMIT 1'); if ($query) { $data = $query->fetchAll(PDO::FETCH_ASSOC); if (isset($data[ 0 ])) { if ($is_single_column) { $out= $data[ 0 ][ preg_replace('/^[\w]*\./i', "", $column) ]; $this->logtime('end'); return $out ; } if ($columns === '*') { $out= $data[ 0 ]; $this->logtime('end'); return $out ; } $stack = array(); foreach ($columns as $key => $value) { if (is_array($value)) { $this->data_map(0, $key, $value, $data[ 0 ], $stack); } else { $this->data_map(0, $key, preg_replace('/^[\w]*\./i', "", $value), $data[ 0 ], $stack); } } $out= $stack[ 0 ]; } else { $out= false; } } else { $out= false; } $this->logtime('end'); return $out ; } public function insert($table, $datas) { $out=false; $lastId = array(); // Check indexed or associative array if (!isset($datas[ 0 ])){ $datas = array($datas); } foreach ($datas as $data){ $values = array(); $columns = array(); foreach ($data as $key => $value){ $columns[] = preg_replace("/^(\(JSON\)\s*|#)/i", "", $key); switch (gettype($value)) { case 'NULL': $values[] = 'NULL'; break; case 'array': preg_match("/\(JSON\)\s*([\w]+)/i", $key, $column_match); $values[] = isset($column_match[ 0 ]) ? $this->quote(json_encode($value)) : $this->quote(serialize($value)); break; case 'boolean': $values[] = ($value ? '1' : '0'); break; case 'integer': case 'double': case 'string': $values[] = $this->fn_quote($key, $value); break; } } $this->exec('INSERT INTO ' . $this->table_quote($table) . ' (`' . implode('`, `', $columns) . '`) VALUES (' . implode($values, ', ') . ')'); $lastId[] = $this->pdo->lastInsertId(); } $out = count($lastId) > 1 ? $lastId : $lastId[ 0 ]; return $out ; } public function lastInsertId() { $lastId[] = $this->pdo->lastInsertId(); $out = count($lastId) > 1 ? $lastId : $lastId[ 0 ]; return $out ; } public function update($table, $data, $where = null) { $out=false; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; $fields = array(); foreach ($data as $key => $value) { preg_match('/([\w]+)(\[(\+|\-|\*|\/)\])?/i', $key, $match); // with numeric expressions if (isset($match[ 3 ])) { if (is_numeric($value)) { $fields[] = $this->column_quote($match[ 1 ]) . ' = ' . $this->column_quote($match[ 1 ]) . ' ' . $match[ 3 ] . ' ' . $value; } } else { $column = $this->column_quote(preg_replace("/^(\(JSON\)\s*|#)/i", "", $key)); switch (gettype($value)) { case 'NULL': $fields[] = $column . ' = NULL'; break; case 'array': preg_match("/\(JSON\)\s*([\w]+)/i", $key, $column_match); $fields[] = $column . ' = ' . $this->quote( isset($column_match[ 0 ]) ? json_encode($value) : serialize($value) ); break; case 'boolean': $fields[] = $column . ' = ' . ($value ? '1' : '0'); break; case 'integer': case 'double': case 'string': $fields[] = $column . ' = ' . $this->fn_quote($key, $value); break; } } } $out= $this->exec('UPDATE ' . $this->table_quote($table) . ' SET ' . implode(', ', $fields) . $where_clause); return $out ; } public function delete($table, $where) { $out=false; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; $out= $this->exec('DELETE FROM ' . $this->table_quote($table) . $where_clause); $this->logtime('end'); return $out ; } public function count($table, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; // notice : we use 'id' instead of '*' as divide the speed by 10 ! $query = $this->query(' SELECT COUNT(id) FROM ' . $this->table_quote($table).$where_clause); $out= $query ? 0 + $query->fetchColumn() : false; $this->logtime('end'); return $out ; } public function max($table, $column = null, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; if (is_null($column)) $column='id'; // notice : we use 'id' instead of '*' as deived the spped by 10 ! $query = $this->query(' SELECT MAX('.$column.') FROM ' . $this->table_quote($table).$where_clause); if ($query) { $max = $query->fetchColumn(); $out= is_numeric($max) ? $max + 0 : $max; } else $out=false; $this->logtime('end'); return $out ; } public function min($table, $column = null, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; if (is_null($column)) $column='id'; // notice : we use 'id' instead of '*' as deived the spped by 10 ! $query = $this->query(' SELECT MIN('.$column.') FROM ' . $this->table_quote($table).$where_clause); if ($query) { $max = $query->fetchColumn(); $out= is_numeric($max) ? $max + 0 : $max; } else $out=false; $this->logtime('end'); return $out ; } public function has($table, $where = null) { $out=''; $where_clause=''; if ($where != null) $where_clause .= ' WHERE ' . $where; $query = $this->query('SELECT EXISTS(SELECT * FROM ' . $this->table_quote($table).$where_clause.')'); if ($query) $out= $query->fetchColumn() === '1'; else $out= false; $this->logtime('end'); return $out ; } protected function column_push(&$columns) { if ($columns == '*') { return $columns; } if (is_string($columns)) { $columns = array($columns); } $stack = array(); foreach ($columns as $key => $value) { if (is_array($value)) { $stack[] = $this->column_push($value); } else { preg_match('/([a-zA-Z0-9_\-\.]*)\s*\(([a-zA-Z0-9_\-]*)\)/i', $value, $match); if (isset($match[ 1 ], $match[ 2 ])) { $stack[] = $this->column_quote( $match[ 1 ] ) . ' AS ' . $this->column_quote( $match[ 2 ] ); $columns[ $key ] = $match[ 2 ]; } else { $stack[] = $this->column_quote( $value ); } } } return implode($stack, ','); } protected function data_map($index, $key, $value, $data, &$stack) { if (is_array($value)) { $sub_stack = array(); foreach ($value as $sub_key => $sub_value) { if (is_array($sub_value)) { $current_stack = $stack[ $index ][ $key ]; $this->data_map(false, $sub_key, $sub_value, $data, $current_stack); $stack[ $index ][ $key ][ $sub_key ] = $current_stack[ 0 ][ $sub_key ]; } else { $this->data_map(false, preg_replace('/^[\w]*\./i', "", $sub_value), $sub_key, $data, $sub_stack); $stack[ $index ][ $key ] = $sub_stack; } } } else { if ($index !== false) { $stack[ $index ][ $value ] = $data[ $value ]; } else { $stack[ $key ] = $data[ $key ]; } } } protected function column_quote($string) { preg_match('/(\(JSON\)\s*|^#)?([a-zA-Z0-9_]*)\.([a-zA-Z0-9_]*)/', $string, $column_match); if (isset($column_match[ 2 ], $column_match[ 3 ])) { return '"' . $this->prefix . $column_match[ 2 ] . '"."' . $column_match[ 3 ] . '"'; } return '"' . $string . '"'; } //-- tools protected function fn_quote($column, $string) { return (strpos($column, '#') === 0 && preg_match('/^[A-Z0-9\_]*\([^)]*\)$/', $string)) ? $string : $this->quote($string); } protected function table_quote($table) { return '"' . $this->prefix . $table . '"'; } public function quote($string) { return $this->pdo->quote($string); } public function error() { return $this->pdo->errorInfo(); } public function last_query() { return end($this->logs); } public function get_log() { return $this->logs; } protected function logtime($msg){ $deltatime= (microtime(true)-$this->t0); $this->timing_trace.= "|$msg ".sprintf("%01.3f", $deltatime). "s "; $this->t0=microtime(true); return true; } public function get_logtime() { return $this->timing_trace; } public function reset_logtime() { return $this->timing_trace=''; } private function logAndTrace($in, $valuesAr) { $debugdatas = array(); $i=0; if ($this->debug_mode){ foreach ($valuesAr as $value){ $debugdatas[$i] =$value ; $i++; } $in['debug']=$debugdatas; return $in ; } else return $in; } public function info() { $output = array( 'server' => 'SERVER_INFO' ,'driver' => 'DRIVER_NAME' ,'client' => 'CLIENT_VERSION' ,'version' => 'SERVER_VERSION' ,'connection' => 'CONNECTION_STATUS' ,'errmode' => 'ERRMODE' ); foreach ($output as $key => $value) { $output[ $key ] = $this->pdo->getAttribute(constant('PDO::ATTR_' . $value)); } return $output; } } // -- end class ?>
16 sept. 2022 à 23:00
c'est bien ce qui me semblait .. tu n'as pas activé la gestion des erreurs PDO
Donc...
Ligne 217, après le code
$this->pdo = new PDO( $dsn, $this->username, $this->password, $this->option ); $this->pdo = new PDO( $dsn, $this->username, $this->password, $this->option );
Tu ajoutes l'instruction
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
ça permettra d'activer la prise en compte des erreurs PDO.
Ensuite, pour en revenir à ton souci .. as tu placé des echo un peu partout dans ton code pour voir où il bloquait éventuellement ?
16 sept. 2022 à 23:01
A noter que pour les variables de type array .. il vaut mieux faire un var_dump
(à la limite.. tu fais des var_dump à la place des echo.. c'est encore plus simple )
18 sept. 2022 à 11:17
Je te remercie de ton aide je lance mon cron plus aucune erreur s'affiche depuis que j'ai mis des var_dump un peu partout . Mais rien ne rentre dans le site.
Je pense et je ne suis pas sur car je ne suis pas un pro en codage je débute et rame que se sont les ligne de l'importation qui sont mal configurer a mes catégories ou sous catégories .
$bien_m ='VEHICULES'; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } }
Je vais voir pour essayer de trouver un webmaster gratuit ( oui je crois au père noël) ou le payer au pire des cas j'en suis sur que c'est un truc a la c** .
18 sept. 2022 à 12:06
Tu dis avoir mis des var_dump .. mais rien ne s'affiche sur ta page .... ce n'est pas normal...
18 sept. 2022 à 12:42
oui regarde
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { echo "i" . $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2);var_dump(fields_opt); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " );var_dump(fields_opt); $user_id = $result_user['id'];var_dump(fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' );var_dump(user_insert_fields); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; $user_id; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref );var_dump(fields_list); var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ; } //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
18 sept. 2022 à 12:53
par contre, si tu mets des exit .. normal que ça ne marche pas...
18 sept. 2022 à 14:19
Cela ne fonctionne pas non plus . https://jetrouvetous.fr/phpsvr/ubiflow_cron2.php sa note juste "io"
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { echo "i" . $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2);var_dump(fields_opt); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " );var_dump(fields_opt); $user_id = $result_user['id'];var_dump(fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' );var_dump(user_insert_fields); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; $user_id; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref );var_dump(fields_list); var_dump($fields_list); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ; } //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
18 sept. 2022 à 15:02
Ligne 261, tu as oublié un dollar
18 sept. 2022 à 16:15
Sa ne change toujours rien .
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { echo "i" . $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2);var_dump(fields_opt); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " );var_dump($fields_opt); $user_id = $result_user['id'];var_dump($fields_opt); if($user_id == null){ $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' );var_dump($user_insert_fields); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); $user_id = $result_insert_user['id']; $user_id; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref );var_dump($fields_list); var_dump($fields_list); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ; } //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }
18 sept. 2022 à 16:35
même pb ligne 233 ....
et puis.. tu peux en ajouter d'autres ( des var_dump et des echo ) dans ton code ? histoire de voir par où passe ton script et où il bloque ....
par exemple, ligne 116 ... faire un var_dump de la variable $cat_type puis ligne 167, un var_dump de la variable $type_bien ...
Et faire pareil un peu partout dans ton code .... bref.. faire ce que je t'ai déjà suggéré à plusieurs reprises...
18 sept. 2022 à 20:02
Voila j'ai remis de echo et des var mais toujours pareil rien ne s'affiche et rien ne rentre dans le site je pense que je vais baiser les bras trop chaud a faire un vrai metier tous sa je suis pas un as comme toi .
<?php // PHP7 READY /****************************************************************************** * ZADS GATEWAY FOR UBIFLOW AUTO * * Note : need bootstrap0.php * * @category CorePackage * @package ZADS * @author romuald boiteux <***@***> * @copyright 2022 * @version 0 ******************************************************************************/ define('DB_MODE', 'pdo'); // both = create two db accesses (one with old mode and one with new mode) require_once("bootstrap0_with_functions.php"); include_once('inc/API_client_lib.php'); /////////////////////////////////// //Importing xml ads ubiflow ////////////////////////////////// function insert_ubiflow_vehicule($url) { global $dbb; $str = ''; $id_ad = ''; $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach($xml->coordonnees->nom as $name => $value) { $nom_entr = $value; } foreach($xml->coordonnees->siret as $name => $value) { $num_entr = $value; } foreach($xml->coordonnees->logo as $name => $value) { $logo_entr = $value; } $array_data = array('reference', 'titre', 'texte','contact_a_afficher', 'email_a_afficher', 'telephone_a_afficher'); $array_data1 = array('code_postal', 'ville', 'departement'); $count = 0; foreach($xml->annonce as $row) { $i = 0; foreach($array_data as $key) { $error = (!isset($row->$key)) ? 4 : 0; if($error == 4) break; $i++; } foreach($array_data1 as $key) { $error = (!isset($row->bien->$key)) ? 4 : 0; if($error == 4) break; $i++; } $departement = ($row->bien->departement); $location_vehicule = getRegionByCp($departement); $reg = $location_vehicule['region']; $county = $location_vehicule['dept']; if(empty($row->prestation->prix)){ $prix = (float) $row->prestation->loyer; }else{ $prix = (float) $row->prestation->prix; } //Inserting annonce if($error == 0) { $name_reg = $reg; $name_dept = $county; //$id_cat = $cat_type; $email = htmlspecialchars($row->email_a_afficher); $ref = htmlspecialchars($row->reference); $postcode = htmlspecialchars($row->bien->code_postal); $city = htmlspecialchars($row->bien->ville); $pays = htmlspecialchars($row->bien->pays); $status = 40; $comp_name = htmlspecialchars($nom_entr); $comp_num = htmlspecialchars($num_entr); $lat = htmlspecialchars($row->bien->latitude); $lng = htmlspecialchars($row->bien->longitude); $type = 'pro'; $name = htmlspecialchars($row->contact_a_afficher); $phone = htmlspecialchars($row->telephone_a_afficher); $title = htmlspecialchars($row->titre); $text = htmlspecialchars($row->texte); $price = htmlspecialchars($prix); $logo = htmlspecialchars($logo_entr); $stamp= date( 'Y-m-d H:i:s', time()); $phone_hidden = htmlspecialchars($row->phone_hidden); //$id_ad = $row->attributes()->{'id'}; $cat_type = htmlspecialchars($row->prestation->type); var_dump($cat_type); $bien_m =''; if (!empty($cat_type)) { switch ($cat_type) { case "V": case "V": $cat_typ = "VEHICULES"; $id_cat = 21; break; case "M": $id_cat = 21; break; case "L": $cat_typ = "Moto"; $id_cat = 22; break; default: $cat_typ = "AUTRES"; $id_cat = 21; break; } } $type_bien =''; $typ_bien = ($row->bien->libelle_type); if (!empty($typ_bien)) { switch ($typ_bien) { case "Voiture": $type_bien = implode('=',array(217 , "voiture")); break; case "Moto": $type_bien = implode('=',array(217 , "Moto")); break; case "Scooter": $type_bien = implode('=',array(217 , "Scooter")); break; default: $type_bien = implode('=',array(217 , $typ_bien)); break; } } var_dump($type_bien); $carrosserie =''; $marque =''; $millesime =''; $kilometrage =''; $energie =''; $couleur =''; $boite_de_vitesse =''; $puissance_fiscale =''; $nb_places =''; $modele =''; $puissance_reelle =''; $nb_rapports =''; $emission_co2 =''; $puissance_kw =''; if (!empty($row->bien->carrosserie)){ $carrosserie = implode('=',array(50 , ($row->bien->carrosserie))); } if (!empty($row->bien->marque)){ $marque = implode('=',array(29 , ($row->bien->marque))); } if (!empty($row->bien->modele)){ $modele = implode('=',array(209 , ($row->bien->modele))); } if (!empty($row->bien->millesime)){ $millesime = implode('=',array(28 , ($row->bien->millesime))); } if (!empty($row->bien->kilometrage)){ $kilometrage = implode('=',array(14 , ($row->bien->kilometrage))); } if (!empty($row->bien->energie)){ $energie = implode('=',array(32 , ($row->bien->energie))); } if (!empty($row->bien->puissance_kw)){ $puissance_kw = implode('=',array(213 , ($row->bien->puissance_kw))); } if (!empty($row->bien->couleur)){ $couleur = implode('=',array(170 , ($row->bien->couleur))); } if (!empty($row->bien->boite_de_vitesse)){ $boite_de_vitesse = implode('=',array(27 , ($row->bien->boite_de_vitesse))); } if (!empty($row->bien->nb_rapports)){ $nb_rapports = implode('=',array(211 , ($row->bien->nb_rapports))); } if (!empty($row->bien->puissance_fiscale)){ $puissance_fiscale = implode('=',array(132 , ($row->bien->puissance_fiscale))); } if (!empty($row->bien->nb_places)){ $nb_places = implode('=',array(176 , ($row->bien->nb_places))); } if (!empty($row->bien->emission_co2)){ $emission_co2 = implode('=',array(176 , ($row->bien->emission_co2))); } if (!empty($row->bien->puissance_reelle)){ $puissance_reelle = implode('=',array(210 , ($row->bien->puissance_reelle))); } //$nb_chambres = implode('=',array(29 , ($row->bien->nb_chambres))); $fields_opt = array($type_bien, $carrosserie, $nb_places, $marque, $modele, $millesime, $kilometrage, $puissance_kw, $energie, $couleur, $boite_de_vitesse, $nb_rapports, $puissance_fiscale, $puissance_reelle, $emission_co2);var_dump($fields_opt); $fields_opt = implode('|' , $fields_opt); $result_user = $dbb->get(DB_TABLE_USERS, ['id', 'status', 'auth'] , " `email` = '".$email."' " );var_dump($fields_opt); $user_id = $result_user['id'];var_dump($fields_opt); if($user_id == null){ echo " user_insert_fields " . $user_insert_fields= array( 'moddate'=>$stamp ,'username'=>$name ,'lastname'=>$comp_name //,'avatarimg'=>$logo ,'email'=>$email ,'phone'=>$phone ,'protype' =>$type ,'procpny' => $comp_name ,'prosiret' => $comp_num ,'loczipcode'=> $postcode ,'loccity'=> $city ,'registerdate'=> $stamp ,'status'=>'40' ,'indir'=>'yes' ,'password'=>bin2hex(openssl_random_pseudo_bytes(16)) ,'auth'=>'lo' ,'createdby'=>'ubiflow' );var_dump($user_insert_fields); $result_insert_user = $dbb->insert(DB_TABLE_USERS, $user_insert_fields); echo " user_id" . $user_id = $result_insert_user['id']; echo " user_id" .$user_id; } $photos = array(); $imgname = array(); $i = 0; if (isset($row->photos->photo) && sizeof($row->photos->photo) > 0) { foreach ($row->photos->photo as $photo) { $photos[] = getImageUbiflow($photo, $ref); $imgname[] = $photos[$i]['basename']; $i++; if ($i == 6){ break; //stop foreach loop after $limit loop } } $imgnames = implode(';',$imgname); } echo " lochash" . $lochash = '&locality='.$city.'&locality\_code='.$city.'&dept='.$name_dept.'&deptcode='.$name_dept.'&administrative\_area\_level\_2\_code='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&administrative\_area\_level\_1\_code='.$name_reg.'&country=France&countrycode=FR&country\_code=FR&postal\_code='.$postcode.'&postal\_code\_code='.$postcode.''; var_dump($lochash); echo " lochashregion" . $lochashregion = '&dept='.$name_dept.'&deptcode='.$name_dept.'&region='.$name_reg.'&regioncode='.$name_reg.'&country=France&countrycode=FR'; var_dump($lochashregion); $fields_list=array( //'id' => $id_ad, 'title' => $title, 'description' => $text, 'catid' => $id_cat, 'type' => $type, 'price' => $price, 'createdate' => $stamp, 'firstpublisheddate' => $stamp, 'moddate' => $stamp, 'email' => $email, 'vfields' => $fields_opt, 'phone' => $phone, 'status' => $status, 'username' => $name, 'location' => $city.','.$pays, 'userid' => $user_id, 'loccity' => $city, 'locdept' => $name_dept, 'locregion' => $name_reg, 'lochash' => $lochash, 'lochashregion' => $lochashregion, 'loccountrycode' => 'FR', 'loczipcode' => $postcode, 'loclatlng' => $lat.'|'.$lng, 'loclng' => $lng, 'loclat' => $lat, 'imgname' => $imgnames, 'sku'=> $ref );var_dump($fields_list); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); echo " ID ADD " . $id_ad ; } //var_dump($fields_list); exit(); if (is_array($fields_list)){ $id_ad = $dbb->insert(DB_TABLE_ITEMS, $fields_list); } }else{ $error = 4; break; } } $result = array('error' => $error, 'comp_name' => $comp_name, 'array_id' => array($id_ad)); return $result; } function getImageUbiflow($url, $ref){ $trace=''; $t0=microtime(true); $target_dir = '../uploads/img/ubiflow/'; $target_dir_tn = '../uploads/img/tn_ubiflow/'; $img_prefix = 'ubiflow_'.$ref; if(!is_dir($target_dir)) { umask(0); mkdir($target_dir, 0777, true); umask(022); } $out=array($success=>true, 'allow_url_fopen'=> ini_get('allow_url_fopen')); $er=0; if(!preg_match('/^(https:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $url, $url_ary)) $er=1; if(empty($url_ary[4])) $er=1; $maxsize = 5000000; $base_filename = substr($url_ary[4],strrpos($url_ary[4],"/")+1); $base_get = '/' . $url_ary[4]; $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80; if($base_filename=="") { $out['success']=false; $out['msg'] = "empty base file name"; return $out;} if (strpos($base_filename, '?') !== false) { $exp = explode('?',$base_filename,-1); $nom = array_pop($exp); }else{ $exp = explode('/',$base_filename); $nom = array_pop($exp); } if(!empty($nom)) { $conthum = (file_get_contents($url,false)); file_put_contents($target_dir_tn.$img_prefix.$nom,$conthum); } if (ini_get('allow_url_fopen')){ $dest_file = $target_dir.$img_prefix.$nom; $alreadyExist = file_exists($dest_file); $out=array('success'=> true, 'basename'=>'ubiflow/'.$img_prefix.$nom, 'dest'=>$dest_file, 'url'=>$url, 'alreadyexist'=>$alreadyExist); if (!$alreadyExist){ // read the URL //$img_file=file_get_contents($url); // get it from API call directly $res= simple_rest_client($url, 'GET'); if ($res['success']) $img_file = $res['response']; if ($img_file){ $file_handler=fopen($dest_file,'w'); if(fwrite($file_handler,$img_file)==false){ $out['success']=false; $out['msg'] = "error in writing file content"; } fclose($file_handler); } else { $out['success']=false; $out['msg'] = "bad response from url "; } $out['filesize'] = strlen($img_file); $out['action'] = 'uploaded'; // add some DEBUG info $out['http_response_header']=$http_response_header; if ($img_file===false) $out['content']= false; else $out['content']= true; } else { $out['action'] = 'skipped-already exist'; $out['filesize']=0; } } else { $out['success']=false; $out['filesize'] =0; $out['msg'] = "allow_url_fopen must be activated in php settings to work"; } $deltatime= (microtime(true)-$t0); $log_time = sprintf("%01.3f", $deltatime); $out['exec_in']=$log_time; return $out ; } function getRegionByCp ($code_postal){ $deps = array( array('Ain','Auvergne-Rhône-Alpes', 01), array('Allier','Auvergne-Rhône-Alpes', 03), array('Ardeche','Auvergne-Rhône-Alpes', 07), array('Cantal','Auvergne-Rhône-Alpes', 15), array('Drome','Auvergne-Rhône-Alpes', 26), array('Isère','Auvergne-Rhône-Alpes', 38), array('Loire','Auvergne-Rhône-Alpes', 42), array('Haute-Loire','Auvergne-Rhône-Alpes', 43), array('Puy-de-Dôme','Auvergne-Rhône-Alpes', 63), array('Rhône','Auvergne-Rhône-Alpes', 69), array('Savoie','Auvergne-Rhône-Alpes', 73), array('Haute-Savoie','Auvergne-Rhône-Alpes', 74), array('Côte-d\'Or','Bourgogne-Franche-Comté', 21), array('Doubs','Bourgogne-Franche-Comté', 25), array('Jura','Bourgogne-Franche-Comté', 39), array('Nièvre','Bourgogne-Franche-Comté', 58), array('Haute-Saône','Bourgogne-Franche-Comté', 70), array('Saône-et-Loire','Bourgogne-Franche-Comté', 71), array('Yonne','Bourgogne-Franche-Comté', 89), array('Territoire de Belfort','Bourgogne-Franche-Comté', 90), array('Côtes-d\'Armor','Bretagne', 22), array('Finistère','Bretagne', 29), array('Ille-et-Vilaine','Bretagne', 35), array('Morbihan','Bretagne', 56), array('Cher','Centre-Val de Loire', 18), array('Eure-et-Loir','Centre-Val de Loire', 28), array('Indre','Centre-Val de Loire', 36), array('Indre-et-Loire','Centre-Val de Loire', 37), array('Loir-et-Cher','Centre-Val de Loire', 41), array('Loiret','Centre-Val de Loire', 45), array('Corse-du-Sud','Corse', "2A"), array('Haute-Corse','Corse', "2B"), array('Moselle','Grand Est', 57), array('Vosges','Grand Est', 88), array('Bas-Rhin','Grand Est', 67), array('Haut-Rhin','Grand Est', 68), array('Aube','Grand Est', 10), array('Marne','Grand Est', 51), array('Haute-Marne','Grand Est', 52), array('Meurthe-et-Moselle', 'Grand Est', 54), array('Ardennes','Grand Est', 8), array('Loiret','Grand Est', 55), array('Aisne','Hauts-de-France', 02), array('Nord','Hauts-de-France', 59), array('Oise','Hauts-de-France', 60), array('Pas-de-Calais','Hauts-de-France', 62), array('Somme','Hauts-de-France', 80), array('Paris','Île-de-France', 75), array('Seine-et-Marne',' Île-de-France', 77), array('Yvelines',' Île-de-France', 78), array('Essonne',' Île-de-France', 91), array('Hauts-de-Seine','Île-de-France', 92), array('Seine-Saint-Denis','Île-de-France', 93), array('Val-de-Marne','Île-de-France', 94), array('Val-d\'Oise', 'Île-de-France', 95), array('Eure','Normandie', 27), array('Orne','Normandie', 61), array('Manche','Normandie', 50), array('Seine-Maritime','Normandie', 76), array('Calvados','Normandie', 14), array('Charente','Nouvelle-Aquitaine', 16), array('Charente-Maritime','Nouvelle-Aquitaine', 17), array('Corrèze','Nouvelle-Aquitaine', 19), array('Creuse','Nouvelle-Aquitaine', 23), array('Dordogne','Nouvelle-Aquitaine', 24), array('Gironde','Nouvelle-Aquitaine', 33), array('Landes','Nouvelle-Aquitaine', 40), array('Lot-et-Garonne','Nouvelle-Aquitaine', 47), array('Pyrénées-Atlantiques','Nouvelle-Aquitaine', 64), array('Deux-Sèvres','Nouvelle-Aquitaine', 79), array('Vienne','Nouvelle-Aquitaine', 86), array('Haute-Vienne','Nouvelle-Aquitaine', 87), array('Ariège','Occitanie', 9), array('Aude','Occitanie', 11), array('Aveyron','Occitanie', 12), array('Gard','Occitanie', 30), array('Gers','Occitanie', 32), array('Haute-Garonne','Occitanie', 31), array('Hérault','Occitanie', 34), array('Lot','Occitanie', 46), array('Lozère','Occitanie', 48), array('Hautes-Pyrénées','Occitanie', 65), array('Pyrénées-Orientales','Occitanie', 66), array('Tarn','Occitanie', 81), array('Tarn-et-Garonne','Occitanie', 82), array('Loire-Atlantique','Pays de la Loire', 44), array('Maine-et-Loire','Pays de la Loire', 49), array('Mayenne','Pays de la Loire', 53), array('Sarthe','Pays de la Loire', 72), array('Vendée','Pays de la Loire', 85), array('Var','Provence-Alpes-Côte d\'Azur', 83), array('Hautes-Alpes','Provence-Alpes-Côte d\'Azur', 05), array('Alpes-de-Haute-Provence','Provence-Alpes-Côte d\'Azur', 04), array('Vaucluse','Provence-Alpes-Côte d\'Azur', 84), array('Alpes-Maritimes','Provence-Alpes-Côte d\'Azur', 06), array('Bouches-du-Rhône ','Provence-Alpes-Côte d\'Azur', 13), array('Guadeloupe','Guadeloupe', 971), array('Martinique','Martinique', 972), array('Guyane','Guyane', 973), array('La Réunion','La Réunion', 974), array('Mayotte','Mayotte', 976), ); foreach ($deps as $dep) { if($code_postal == $dep[2]) { $departement = $dep[0]; $region = $dep[1]; } } $result = array('dept' => $departement, 'region' => $region); return $result; }