SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to implement a simple login with Sharepoint on a PHP existing application. I have read many information (some related to Client side login -but only works for windows AFAIK-) and forums like this one [1] and with this approach I been able to login with the credentials of a user in a trial of Office365.

You can test it here with:

Login: cristianpark
Password: crisPaRK01

It says 'login satisfactorio' (successful login) but if I try with some user from a registered sharepoint, I don't know how is the plan they have but they use emails like: instead of, with credentials like that, the script doesn't work, it shows some text on red. I'll try another things I have read but I want to know if you know if there is a better way of accomplish the login in a Linux box with PHP

Thanks in advance


share|improve this question

phpSPO - SharePoint client for PHP The library provides a SharePoint Online (SPO) client for PHP applications. It allows you to performs CRUD operations on SharePoint data using an SharePoint 2013 REST/OData based API.


How to perform authentication in SharePoint Online (SPO):

try {
    $client = new SPOClient($url);
    echo 'You have authenticated successfully\n';
catch (Exception $e) {
    echo 'Authentication failed: ',  $e->getMessage(), "\n";

The following examples demonstrates how to perform CRUD operations on SharePoint list data:


require_once 'SPOClient.php';

$username = '';
$password = 'password';
$url = "";

$client = new SPOClient($url);

//Get Tasks list
$listTitle = 'Tasks';
$list = $client->getList($listTitle);

//Create a Task item
$itemProperties = array('Title' => 'Order Approval', 'Body' => 'Order approval task');
$taskItem = $list->addItem($itemProperties);
print "Task '{$taskItem->Title}' has been created succesfully.\r\n";

$itemId = $taskItem->Id;
//Update a Task item
$itemProperties = array('PercentComplete' => 1);

//Delete a Task item



SharePoint Online client for PHP

share|improve this answer

The script will only work with registered users, given access to your trial tennent (i believe you get 10 users maximum). On the other hand, if you haven't configured your own domain in Office 365 than you can only use

If you plan to Federate with your own domain, that is totally another story and it requires so much more configuration or the use of ACS from Azure.

share|improve this answer
Hi C. Marius, thanks for your answer – Cristianpark May 30 '13 at 17:16
Enter when I shouldn't ¬¬ I must say I'm not familiar with MS Services and I don't know if the last you say is the case. What I'm looking for is authenticate users from a sharepoint online where users have emails like (instead of like the ones of the office365 trial), with the users from trial the script works, but with the others from a existing sharepoint with custom domain, it doesn't, I have to configure something on that sharepoint admin?? – Cristianpark May 30 '13 at 17:24
Yes, prior to being able to login with your organisation account you need to configure your domain inside Office365 (…). Secondly, you need to federate with your own domain if you plan to have your users to login with the same credentials as in your own AD. Alternatively, you should be able to Invite external people with other email addresses, and they should configure their own connection. – Marius Constantinescu - MVP May 30 '13 at 22:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.