Ouvrir un fichier avec authentification NTLM
Bonjour,
Je veux ouvrir un fichier se trouvant sur un serveur IIS ou j'ai besoin d'être authentifié pour l'exploiter.
J'ai trouvé un script avec une authentification Basic mais je ne vois comment me loguer avec l'identification NTLM :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?php
$host = 'srvlocal';
$uri = "monfichier.aspx";
$usr = "user";
$pwd = "password";
header ("Content-type: text/html");
$sock = fsockopen ($host, 209, $errno, $errstr, 5); // 80 = Port 5 = Timeout
if(!$sock){
echo "$errstr ($errno)<br />\n";
} else {
//echo 'connexion passe';
fputs ($sock, "GET". $uri. "HTTP/1.1 \r\n");
fputs ($sock, "Host:". $host. "\r\n");
fputs ($sock, "Authorization: Basic". base64_encode ($usr. ":". $pwd). "\r\n");
fputs ($sock, "Connection: close \r\n\r\n");
while (!feof ($sock))
echo fgets ($sock, 14096);
fclose ($sock);
}
?> |
J'ai essayé de remplacé Basic par NTLM sans succès...
Voici l'erreur qui m'est retournée
Citation:
HTTP/1.1 400 Bad Request Content-Type: text/html Date: Thu, 02 Dec 2010 16:08:24 GMT Connection: close Content-Length: 35
Bad Request (Invalid Verb)
Auriez-vous une idée ? Merci d'avance