Link to home
Start Free TrialLog in
Avatar of OmniUnlimited
OmniUnlimitedFlag for United States of America

asked on

PHP NTLM Authentication

Hello Experts!

I need help from an expert in both PHP and NTLM to help me to find out how I can access a wsdl and get back a valid SOAP response.

I know that NTLM uses a multi-step authentication process, and all of this is new to me since up to this point I have only been using basic authentication, does anyone know if there is any way that this can be accomplished through CURL (and please, I only need responses from those that have had proven results.  I've already been all through the web and can't find a solution that works.)

Thanks a million!
ASKER CERTIFIED SOLUTION
Avatar of ghodder
ghodder
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just tested this code against my Sharepoint server from my Linux server:

<?php
  $username = 'myuser';
  $password = 'mypass';
  $url = 'http://intranet';

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
  curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");

  $output = curl_exec($ch);
  $result = curl_getinfo($ch);

  echo $result['http_code'];

Open in new window


On successful authentication I received a webpage saying the object had moved (since http://intranet is the shorthand for my LAN FQDN which hosts Sharepoint)

On failure I received a 401 response i.e. Authentication failure.

I tested this by specifying a correct/incorrect password for the user.
Avatar of OmniUnlimited

ASKER

OMG, you are a freaking genius!  I could have never suspected that the solution would be so simple! :)