1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?php
$postfields = array();
$postfields["action"] = "index.php";
$postfields["tstlang"] = "fr";
$postfields["delcookie"] = "0";
$postfields["usernameda"] = "******";
$postfields["password"] = "*****";
$postfields["login"] = "submit";
$postfields["stamp"] = "1412684706";
//url de la page de soumission
$url = "http://www.doyen-auto.net/php/site/index.php";
$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
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);
//on peut faire un echo du résultat obtenu
echo $result;
curl_close($ch);
?> |
Partager