'.$cookie.''; /** * Deuxième partie * Récupération de la fiche * $cookie, $id, $lang, $host, $port */ $data = 'id_terme=' . $id . '&sPriLang=' . $lang . '&sSecLang=' . urlencode('') . '&iModeRecherche=' . urlencode('1') . '&affichage_equiv=' . urlencode('') . '&bAffFicheBilingue=' . urlencode('0'); $sock = fsockopen($host, $port, $errno, $errstr, 30); if (!$sock) die("$errstr ($errno)\n"); $fileName = '/btml/fra/r_motclef/fiche.asp'; fwrite($sock, "POST ".$fileName." HTTP/1.0\r\n"); fwrite($sock, 'Cookie: BTMLTest='.urlencode('test=ok').";$cookie\r\n"); fwrite($sock, "Host: ".$host."\r\n"); fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n"); fwrite($sock, "Content-length: " . strlen($data) . "\r\n"); fwrite($sock, "Accept: */*\r\n"); fwrite($sock, "\r\n"); fwrite($sock, "$data\r\n"); fwrite($sock, "\r\n"); $headers = ""; while ($str = trim(fgets($sock, 4096))) $headers .= "$str\n"; $body = ""; while (!feof($sock)) $body .= fgets($sock, 4096); fclose($sock); // si on a déjà une session, on l'utilise 10 minutes if ( $key!='' ) { setCookie($key, $value,time()+600); } /** * Troisième partie * Affichage de la fiche * $body */ header('Content-type: text/html;charset=UTF-8'); $body = preg_replace("/]+>/","",$body); $body = preg_replace("/JavaScript:affichage\('1','(\d+)','([A-Z]{3})','','1'\)/","gd.php?id=$1&lang=$2",$body); $body = str_replace('', '

Tiré du site www.granddictionnaire.com

', $body); echo $body; ?>