Recherche dans un pdf avec un php

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Recherche dans un pdf avec un php

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 19:40

Ah ok, je comprends mieux. ET vraiment merci de prendre le temps de me répondre
Je viens d'essayer mais quand j'appelle le script depuis mon site (http://www.monsite.com/app_offre.php)
je tombe bien bien sur le formulaire du site sur lequel je souhaite faire la recherche, ce formulaire est pré rempli avec les infos renseignées avec cURL...
Mais je n'ai que les 10 premiers résultats...? comment récupérer ces résultats?
S'il faut que je renseigne manuellement les liens des pages suivantes ce n'est pas grave je peux le faire...
En tout cas la recherche se lance bien ! c'est génial!!!

Exemple:
page 1 :http://e-marchespublics.com/recherche_d ... _2__0.html
page 2 :http://e-marchespublics.com/recherche_d ... _2__1.html
page 3 :http://e-marchespublics.com/recherche_d ... _2__2.html

etc.

je peux le faire manuellement ce n'est pas grave, le plus important c'est de récupérer les avis qui sont liés à cette recherche...


FORMULAIRE DU SITE SUR LEQUEL MON SCRIPT DEVRAIT AGIR
<tr>
		<td>
		<div id="trouverappel" style="width: 540px; height: 70px; padding: 6px;">
		<form name="form1" action="/recherche_d_appels_d_offres_marches_publics_1_aapc_______2__0.html" method="post">
		<table style="float: left;" width="540" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="32" valign="top"><label for="mot_clé"> Tapez ici votre mot-clé <br>

				et cliquez sur <strong class="bleufonce">"Trouvez!"</strong></label> <input type="hidden" name="type_avis" value="" /></td>
				<td valign="top"><label for="region"><strong>Option : </strong><br>
				sélectionnez votre zone géographique</label></td>
				<td valign="middle">&nbsp;</td>
			</tr>
			<tr valign="middle">

				<td width="260"><input name="mot_cle" id="clef" style="width: 225px;" class="clef" type="text" maxlength="40" value="" /></td>
				<td width="260"><SELECT NAME="departement" style="width: 225px;">
					<OPTION VALUE="">Toutes les régions</OPTION>
					<option VALUE="">&nbsp;</option>
					<OPTION VALUE="67,68"  style="background-color: #F7F7EA;">Alsace</OPTION>
					<OPTION VALUE="67" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;67 Rhin-bas</OPTION>
					<OPTION VALUE="68" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;68 Rhin-haut</OPTION>

					<OPTION VALUE="24,33,40,47,64"  style="background-color: #F7F7EA;">Aquitaine</OPTION>
					<OPTION VALUE="24" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;24 Dordogne</OPTION>
					<OPTION VALUE="33" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;33 Gironde</OPTION>
					<OPTION VALUE="40" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40 Landes</OPTION>
					<OPTION VALUE="47" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;47 Lot-et-Garonne</OPTION>
					<OPTION VALUE="64" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;64 Pyrenees-Atlantiques</OPTION>

					<OPTION VALUE="03,15,43,63"  style="background-color: #F7F7EA;">Auvergne</OPTION>
					<OPTION VALUE="03" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;03 Allier</OPTION>
					<OPTION VALUE="15" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15 Cantal</OPTION>
					<OPTION VALUE="43" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;43 Haute-Loire</OPTION>
					<OPTION VALUE="63" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;63 Puy-de-dome</OPTION>

					<OPTION VALUE="14,50,61"  style="background-color: #F7F7EA;">Basse-Normandie</OPTION>
					<OPTION VALUE="14" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14 Calvados</OPTION>
					<OPTION VALUE="50" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50 Manche</OPTION>
					<OPTION VALUE="61" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;61 Orne</OPTION>

					<OPTION VALUE="21,58,71,89"  style="background-color: #F7F7EA;">Bourgogne</OPTION>
					<OPTION VALUE="21" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;21 Cote-d or</OPTION>

					<OPTION VALUE="58" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;58 Nievre</OPTION>
					<OPTION VALUE="71" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;71 Saone-et-Loire</OPTION>
					<OPTION VALUE="89" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;89 Yonne</OPTION>

					<OPTION VALUE="22,29,35,56"  style="background-color: #F7F7EA;">Bretagne</OPTION>
					<OPTION VALUE="22" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;22 Cotes-d Armor</OPTION>
					<OPTION VALUE="29" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;29 Finistere</OPTION>

					<OPTION VALUE="35" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;35 Ille-et-Vilaine</OPTION>
					<OPTION VALUE="56" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;56 Morbihan</OPTION>

					<OPTION VALUE="18,45,41,37,36,28"  style="background-color: #F7F7EA;">Centre</OPTION>
					<OPTION VALUE="18" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;18 Cher</OPTION>
					<OPTION VALUE="28" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;28 Eure-et-Loir</OPTION>
					<OPTION VALUE="36" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;36 Indre</OPTION>

					<OPTION VALUE="37" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;37 Indre-et-Loire</OPTION>
					<OPTION VALUE="41" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;41 Loir-et-Cher</OPTION>
					<OPTION VALUE="45" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;45 Loiret</OPTION>

					<OPTION VALUE="52,51,10,08"  style="background-color: #F7F7EA;">Champagne-Ardenne</OPTION>
					<OPTION VALUE="08" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;08 Ardennes</OPTION>
					<OPTION VALUE="10" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10 Aube</OPTION>

					<OPTION VALUE="51" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;51 Marne</OPTION>
					<OPTION VALUE="52" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;52 Marne-haute</OPTION>

					<OPTION VALUE="20"  style="background-color: #F7F7EA;">Corse</OPTION>
					<OPTION VALUE="20" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2A Corse-du-Sud</OPTION>
					<OPTION VALUE="20" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2B Corse Haute</OPTION>

					<OPTION VALUE="25,39,70,90"  style="background-color: #F7F7EA;">Franche-Comté</OPTION>
					<OPTION VALUE="25" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25 Doubs</OPTION>
					<OPTION VALUE="39" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;39 Jura</OPTION>
					<OPTION VALUE="70" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;70 Saone-Haute</OPTION>
					<OPTION VALUE="90" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;90 Territoire de Belfort</OPTION>

					<OPTION VALUE="27,76"  style="background-color: #F7F7EA;">Haute-Normandie
					
					
					<OPTION VALUE="27" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;27 Eure</OPTION>

					<OPTION VALUE="76" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;76 Seine-Maritime</OPTION>

					<OPTION VALUE="95,94,93,92,91,78,77,75"  style="background-color: #F7F7EA;">Ile-de-France</OPTION>
					<OPTION VALUE="75" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;75 Paris</OPTION>
					<OPTION VALUE="77" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;77 Seine-et-Marne</OPTION>
					<OPTION VALUE="78" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;78 Yvelines</OPTION>
					<OPTION VALUE="91" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;91 Essonne</OPTION>

					<OPTION VALUE="92" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;92 Hauts-de-Seine</OPTION>
					<OPTION VALUE="93" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;93 Seine-Saint-Denis</OPTION>
					<OPTION VALUE="94" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;94 Val-de-Marne</OPTION>
					<OPTION VALUE="95" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;95 Val-d'Oise</OPTION>

					<OPTION VALUE="66,48,34,30,11"  style="background-color: #F7F7EA;">Languedoc-Roussillon</OPTION>
					<OPTION VALUE="11" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11 Aude</OPTION>

					<OPTION VALUE="30" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;30 Gard</OPTION>
					<OPTION VALUE="34" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;34 Herault</OPTION>
					<OPTION VALUE="48" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;48 Lozere</OPTION>
					<OPTION VALUE="66" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;66 Pyrenees-Orientales</OPTION>

					<OPTION VALUE="87,23,19"  style="background-color: #F7F7EA;">Limousin</OPTION>
					<OPTION VALUE="19" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19 Correze</OPTION>

					<OPTION VALUE="23" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;23 Creuse</OPTION>
					<OPTION VALUE="87" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;87 Vienne-Haute</OPTION>

					<OPTION VALUE="88,55,54,57"  style="background-color: #F7F7EA;">Lorraine</OPTION>
					<OPTION VALUE="54" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;54 Meurthe-et-Moselle</OPTION>
					<OPTION VALUE="55" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;55 Meuse</OPTION>
					<OPTION VALUE="57" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;57 Moselle</OPTION>

					<OPTION VALUE="88" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;88 Vosges</OPTION>

					<OPTION VALUE="82,81,65,46,32,31,09,12"  style="background-color: #F7F7EA;">Midi-Pyrénées</OPTION>
					<OPTION VALUE="09" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;09 Ariege</OPTION>
					<OPTION VALUE="12" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12 Aveyron</OPTION>
					<OPTION VALUE="31" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;31 Haute-Garonne</OPTION>
					<OPTION VALUE="32" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32 Gers</OPTION>

					<OPTION VALUE="46" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46 Lot</OPTION>
					<OPTION VALUE="65" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;65 Pyrenees-Hautes</OPTION>
					<OPTION VALUE="81" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;81 Tarn</OPTION>
					<OPTION VALUE="82" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;82 Tarn-et-Garonne</OPTION>

					<OPTION VALUE="59,62"  style="background-color: #F7F7EA;">Nord-Pas-de-Calais</OPTION>
					<OPTION VALUE="59" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;59 Nord</OPTION>

					<OPTION VALUE="62" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;62 Pas-de-Calais</OPTION>

					<OPTION VALUE="971,972,973,974,975,976,984,986,987,988"  style="background-color: #F7F7EA;">Outre-Mer</OPTION>
					<OPTION VALUE="971" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;971 Guadeloupe</OPTION>
					<OPTION VALUE="972" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;972 Martinique</OPTION>
					<OPTION VALUE="973" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;973 Guyane</OPTION>
					<OPTION VALUE="974" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;974 La Réunion</OPTION>

					<OPTION VALUE="975" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;975 St-Pierre-et-Miquelon</OPTION>
					<OPTION VALUE="976" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;976 Mayotte</OPTION>
					<OPTION VALUE="984" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;984 Terres australes et Antartiques</OPTION>
					<OPTION VALUE="986" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;986 Wallis-et-Futuna</OPTION>
					<OPTION VALUE="987" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;987 Polynésie française</OPTION>
					<OPTION VALUE="988" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;988 Nouvelle-Calédonie</OPTION>

					<OPTION VALUE="85,72,53,49,44"  style="background-color: #F7F7EA;">Pays de la Loire</OPTION>
					<OPTION VALUE="44" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;44 Loire-Atlantique</OPTION>
					<OPTION VALUE="49" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;49 Maine-et-Loire</OPTION>
					<OPTION VALUE="53" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;53 Mayenne</OPTION>
					<OPTION VALUE="72" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;72 Sarthe</OPTION>
					<OPTION VALUE="85" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;85 Vendee</OPTION>

					<OPTION VALUE="80,60,02"  style="background-color: #F7F7EA;">Picardie
					
					
					<OPTION VALUE="02" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;02 Aisne</OPTION>
					<OPTION VALUE="60" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;60 Oise</OPTION>
					<OPTION VALUE="80" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;80 Somme</OPTION>

					<OPTION VALUE="86,79,17,16"  style="background-color: #F7F7EA;">Poitou-Charentes</OPTION>
					<OPTION VALUE="16" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16 Charente</OPTION>

					<OPTION VALUE="17" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;17 Charente-Maritime</OPTION>
					<OPTION VALUE="79" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;79 Deux-Sevres</OPTION>
					<OPTION VALUE="86" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;86 Vienne</OPTION>

					<OPTION VALUE="84,83,13,06,05,04"  style="background-color: #F7F7EA;">Provence-Alpes-Côte d'Azur</OPTION>
					<OPTION VALUE="04" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;04 Alpes-de-Haute-Provence</OPTION>
					<OPTION VALUE="05" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05 Alpes Hautes</OPTION>

					<OPTION VALUE="06" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;06 Alpes-Maritimes</OPTION>
					<OPTION VALUE="13" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13 Bouches-du-Rhone</OPTION>
					<OPTION VALUE="83" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;83 Var</OPTION>
					<OPTION VALUE="84" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;84 Vaucluse</OPTION>

					<OPTION VALUE="74,73,69,42,38,26,07,01"  style="background-color: #F7F7EA;">Rhône-Alpes</OPTION>
					<OPTION VALUE="01" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;01 Ain</OPTION>

					<OPTION VALUE="07" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;07 Ardeche</OPTION>
					<OPTION VALUE="26" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;26 Drome</OPTION>
					<OPTION VALUE="38" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;38 Isere</OPTION>
					<OPTION VALUE="42" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42 Loire</OPTION>
					<OPTION VALUE="69" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;69 Rhone</OPTION>
					<OPTION VALUE="73" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;73 Savoie</OPTION>

					<OPTION VALUE="74" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;74 Savoie-haute</OPTION>
				</SELECT></td>
				<td><INPUT TYPE="hidden" name="actif" value="1"><input type="submit" name="SubmitRecherche" value="Trouvez !"></td>
			</tr>
		</table>
		<div id="trouverappelhidden"><input type=hidden name=categorie value=></div>
		</form>
	
	</tr>

MON ENFIN TON SCRIPT MODIFIE AVEC LES INFOS QUE JE SOUHAITE RECUPERER

<?php
$url = 'http://e-marchespublics.com/recherche_d_appels_d_offres_marches_publics_1_aapc_______2__0.html';

$postfields = array('type_avis' => '',
                    'departement' => '67',
                    'submit' => 'SUBMIT');

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$result = curl_exec($ch);


echo $result;
?>

Re: Recherche dans un pdf avec un php

par stealth35 » 26 janv. 2011, 18:59

il faut envoyer les réponse comme un formulaire donc a l'adresse du formulaire, pas la page ou tu le remplis :
$url = 'http://e-marchespublics.com/include/choix_recherche_accueil.php';

$postfields = array('type_avis' => 'aapc', 
                    'departement' => '67', 
                    'submit' => 'SUBMIT');

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$result = curl_exec($ch);

echo $result;

//Aller la page 2
curl_setopt($ch, CURLOPT_URL, $url . 'http://e-marchespublics.com/recherche_d_appels_d_offres_marches_publics_1_________2__1.html');
$result = curl_exec($ch);

echo $result;

curl_close($ch);

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 18:10

J'ai vraiment besoin d'aide svp...

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 16:51

Personne aurait une idée pour résoudre ce problème par hasard? je regarde partout mais rien ne correspond à ça sur internet... :cry:

merci

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 14:58

Est-ce que le php il faut le mettre à la racine de mon site? il y a une erreur de codage pour que ça produise cette erreur, non?

Merci

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 12:34

merci.
J'ai retiré les curl_close mais toujours pas de résultat, lorsque je clique sur rechercher mon navigateur affiche dans la barre d'adresse:
http://www.site.com/include/choix_recherche_accueil.php

Message : Not Found
The requested URL /include/choix_recherche_accueil.php was not found on this server.
<?php

//creation du cookie
$fp = fopen("cookies.txt",'wb');    fclose($fp);

//on recupere le cookie

$url="http://e-marchespublics.com/";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);  curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');

curl_exec($ch);


// on continue... 1er form

$url = "http://e-marchespublics.com/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');
$postfields = array();
$postfields["type_avis"] = "aapc";
$postfields["departement"] = "67";
$postfields["submit"] = "SUBMIT";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);


//fin du  form

//On affiche le resultat:

echo $result;

?>

Re: Recherche dans un pdf avec un php

par stealth35 » 26 janv. 2011, 12:23

Pas d'idées ? :cry:
il faut rester dans la même session cURL, comme dans un navigateur, le curl_close correspond a fermer la fenêtre

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 12:21

Pas d'idées ? :cry:

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 01:22

je viens de faire ça, le formulaire se remplie bien mais je n'arrive pas à afficher le résultat...
Pour infos j'ai changé de site...

Merci par avance.
<?php

//creation du cookie
$fp = fopen("cookies.txt",'wb');    fclose($fp);

//on recupere le cookie

$url="http://e-marchespublics.com/";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);  curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');

curl_exec($ch);
curl_close($ch);

// on continue... 1er form

$url = "http://e-marchespublics.com/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');
$postfields = array();
$postfields["type_avis"] = "aapc";
$postfields["departement"] = "67";
$postfields["submit"] = "SUBMIT";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
curl_close($ch);

//fin du  form 

//On affiche le resultat:

echo $result;

?>

Re: Recherche dans un pdf avec un php

par orell1 » 26 janv. 2011, 00:05

voila qui devrait être mieux
<?php
$postfields = 'array';
$postfields["action"] = "submit";
$postfields["title"] = "Titre Test";
$postfields["url"] = "http://www.boamp.fr";
$postfields["recurl"] = "http://www.boamp.fr";
$postfields["description"] = "annuaire";
$postfields["email"] = "[email protected]";
//$postfields["add2newsletter"] = "1";
//url de la page de soumission
//ici mon annuaire (qui a un captcha donc inutile de tenter la soumission auto, c'est pour l'exemple)
$url = "http://www.boamp.fr/index.php?action=afficherFormRechAvancee";
$useragent = "Mozilla/5.0";
$referer = $url; 
 
//Initialise une session CURL
$ch = curl_init($url);
//CURL options
curl_setopt($ch, CURLOPT_POST, 1);
//On poste les données du tableau $postfields
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
//On définit un useragent ici Mozilla/5.0
//souvent les bots se font passés pour googlebot ce qui finalement est stupide
//On passe donc un useragent banal
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
//On passe un referrer ici on passe la même page $url
curl_setopt($ch, CURLOPT_REFERER, $referer);
//on récupère le contenu de la page de résultat de la soumission dans une chaine
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// en cas de redirection (facultatif ici)
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//Page de résultats et fermeture de session
$result = curl_exec($ch);
curl_close($ch);
 
//on peut faire un echo du résultat obtenu
echo $result;
?>

Re: Recherche dans un pdf avec un php

par orell1 » 25 janv. 2011, 23:55

Tu es trop fort! :wink:
je regarde un peu partout sur le net et pas mal de gens cherchent le même truc que moi.
Remplir un formulaire grace à cURL et afficher le résultat distant...

Je vais bien trouver à force de chercher...

Re: Recherche dans un pdf avec un php

par stealth35 » 25 janv. 2011, 23:51

pourquoi avoir mis :
if (preg_match('`^https://`i', $url))
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
}
ca sent le copié collé :mrgreen:

Re: Recherche dans un pdf avec un php

par orell1 » 25 janv. 2011, 23:38

Peux tu me dire stp si je suis sur la bonne voie...?
<?php

$url = 'http://www.boamp.fr';
$timeout = 10;

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

if (preg_match('`^https://`i', $url))
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
}

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Utilisation de la méthode POST
curl_setopt($ch, CURLOPT_POST, true);

// Définition des champs et valeurs à envoyer
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'email' => '[email protected]'
));

$page_content = curl_exec($ch);

curl_close($ch);

echo $page_content;

?> 
Merci

Re: Recherche dans un pdf avec un php

par orell1 » 25 janv. 2011, 23:11

ok merci.
je vais me documenter sur ces outils alors...
Je vais essayer, qui ne tente rien...

Merci pour ton aide, heureusement qu'il y a des gens comme toi pour nous guider... j'ai beaucoup appris ici! :D

Re: Recherche dans un pdf avec un php

par stealth35 » 25 janv. 2011, 23:08

Bah tu sais quand j'ai une idée en tête et que je n'y arrive pas je reste bloquer dessus jusqu'à ce que j'y arrive... Je déteste ne pas réussir et je ne demande qu'apprendre... Donc pour moi ça vaut le coup.
Après je comprends que toi tu aies autre chose à faire...
je comprend bien que c'est pour toi, ou pour bosser, t'as tes raisons, mais vu que c'est trop légale, je te dis juste que c'est faisable, je t'ai cité les outils, à toi de joué après. :wink: